Skip to content

Instantly share code, notes, and snippets.

View DaveRuijter's full-sized avatar

Dave Ruijter DaveRuijter

View GitHub Profile
@DaveRuijter
DaveRuijter / Assign AD Users Power BI Free license.ps1
Last active April 11, 2024 12:54
Use PowerShell to assign the 'Power BI Free' license to all users in the tenant. This makes sure they will not get the 'welcome wizard' to setup their account for the first time.
# install module
Install-Module AzureAD -Scope CurrentUser # if already installed you can skip this line
Import-Module AzureAD # if already imported you can skip this line
# connect
Connect-AzureAD # this will initiate a dialog to enter credentials
# Find the SkuID of the license we want to add - in this case the Power BI Free license, which is called "POWER_BI_STANDARD"
$PowerBIFreeSKUId = Get-AzureADSubscribedSku | Where-Object {$_.SkuPartNumber -eq "POWER_BI_STANDARD"} | Select -ExpandProperty SkuId
@DaveRuijter
DaveRuijter / PowerBIEmbeddedScheduledAutoscaling.ps1
Last active August 9, 2023 20:09
PowerShell script to vertically scale up and down or pause/resume an Azure Power BI Embedded Capacity according to a schedule. You can use this in an Azure Automation Runbook.
<#
.SYNOPSIS
Vertically scale up and down or pause/resume an Azure Power BI Embedded Capacity according to a schedule using Azure Automation.
.DESCRIPTION
This Azure Automation runbook enables vertically scaling or pausing of an Azure Power BI Embedded Capacity according to a schedule. Autoscaling based on a schedule allows you to scale your solution according to predictable resource demand. For example you could require a high capacity (e.g. A5) on monday during peak hours, while the rest of the week the traffic is decreased, allowing you to scale down (e.g. A1). Outside business hours and during weekends you could then suspend the capacity so no charges will be applied. This runbook can be scheduled to run hourly. The code checks the scalingSchedule parameter to decide if scaling needs to be executed, or if the capacity is in the desired state already and no work needs to be done. The script is time zone aware.
.PARAMETER resourceGroupName
Name of the resource group to which the
@DaveRuijter
DaveRuijter / PowerBIEmbeddedResumeCapacity.ps1
Created November 19, 2018 22:28
PowerShell script that enables resuming of an Azure Power BI Embedded Capacity.
<#
.SYNOPSIS
Resume an Azure Power BI Embedded Capacity using Azure Automation.
.DESCRIPTION
This Azure Automation runbook enables resuming of an Azure Power BI Embedded Capacity.
.PARAMETER resourceGroupName
Name of the resource group to which the capacity is assigned.
<#
.SYNOPSIS
Pause/suspend an Azure Power BI Embedded Capacity using Azure Automation.
.DESCRIPTION
This Azure Automation runbook enables pausing/suspending of an Azure Power BI Embedded Capacity.
.PARAMETER resourceGroupName
Name of the resource group to which the capacity is assigned.
@DaveRuijter
DaveRuijter / ADF_Scale_Azure_AS.json
Last active December 24, 2018 10:58
Azure Data Factory pipeline definition with a Web Activity to scale an Azure Analysis Services server. The pipeline is parameterized. The call to AAS is synchronous, hence it waits for the scale operation to complete.
{
"name": "ADF_Scale_Azure_AS",
"properties": {
"activities": [
{
"name": "00_Scale_Azure_AS",
"type": "WebActivity",
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
@DaveRuijter
DaveRuijter / ADF_Scale_Azure_SQLDB.json
Created December 24, 2018 11:01
Azure Data Factory pipeline definition with a Web Activity to scale an Azure SQL Database. The pipeline is parameterized. The call to Azure SQL is synchronous, hence it waits for the db scale operation to complete.
{
"name": "ADF_Scale_Azure_SQLDB",
"properties": {
"activities": [
{
"name": "ADF_Scale_Azure_SQLDB",
"type": "WebActivity",
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
@DaveRuijter
DaveRuijter / pl_PBI_dataset_refresh.json
Last active November 28, 2022 19:23
Azure Data Factory pipeline to refresh a Power BI dataset using a Service Principal, and Azure Key Vault.
{
"name": "pipeline1",
"properties": {
"activities": [
{
"name": "Call dataset refresh",
"type": "WebActivity",
"dependsOn": [
{
"activity": "Get AAD Token",
@DaveRuijter
DaveRuijter / AddServicePrincipalToPowerBIWorkspaces.ps1
Last active July 22, 2022 09:11
Script to add Service Principal to Power BI workspaces
# =================================================================================================================================================
## This script will add the given Service Principal to Power BI workspaces
## It will first ask for the (correct) ObjectId of the Service Principal
## Then it will ask for the credentials of a Power BI Service Administrator
## Note: this script only works with v2 workspaces (you can't add a Service Principal to a v1 workspace)
# =================================================================================================================================================
## Parameters
@DaveRuijter
DaveRuijter / RemoveServicePrincipalFromPowerBIWorkspaces.ps1
Created September 21, 2020 11:23
Script to remove Service Principal from Power BI workspaces
# =================================================================================================================================================
## This script will remove the given Service Principal from Power BI workspaces
## It will first ask for the (correct) ObjectId of the Service Principal
## Then it will ask for the credentials of a Power BI Service Administrator
# =================================================================================================================================================
## Parameters
# Remove the Service Principal from workspaces that are in Premium capacity?
$RemoveFromPremiumCapacityWorkspaces = $true
@DaveRuijter
DaveRuijter / pull_request_template.md
Created October 3, 2021 19:12
Azure DevOps Pull Request template with type of update

Type of update

  • Fix
  • Feature
  • Big feature