Skip to content

Instantly share code, notes, and snippets.

Avatar

Dave Ruijter DaveRuijter

View GitHub Profile
@DaveRuijter
DaveRuijter / Assign AD Users Power BI Free license.ps1
Last active Sep 19, 2020
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.
View Assign AD Users Power BI Free license.ps1
# 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 Apr 27, 2020
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.
View PowerBIEmbeddedScheduledAutoscaling.ps1
<#
.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 Nov 19, 2018
PowerShell script that enables resuming of an Azure Power BI Embedded Capacity.
View PowerBIEmbeddedResumeCapacity.ps1
<#
.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.
View PowerBIEmbeddedPauseCapacity.ps1
<#
.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 Dec 24, 2018
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.
View ADF_Scale_Azure_AS.json
{
"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 Dec 24, 2018
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.
View ADF_Scale_Azure_SQLDB.json
{
"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 Jul 27, 2020
Azure Data Factory pipeline to refresh a Power BI dataset using a Service Principal, and Azure Key Vault.
View pl_PBI_dataset_refresh.json
{
"name": "pipeline1",
"properties": {
"activities": [
{
"name": "Call dataset refresh",
"type": "WebActivity",
"dependsOn": [
{
"activity": "Get AAD Token",
@DaveRuijter
DaveRuijter / AddServicePrincipalToPowerBIWorkspaces.ps1
Last active Sep 21, 2020
Script to add Service Principal to Power BI workspaces
View AddServicePrincipalToPowerBIWorkspaces.ps1
# =================================================================================================================================================
## 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 Sep 21, 2020
Script to remove Service Principal from Power BI workspaces
View RemoveServicePrincipalFromPowerBIWorkspaces.ps1
# =================================================================================================================================================
## 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
You can’t perform that action at this time.