Created
June 16, 2023 00:17
-
-
Save dgosbell/1ab4ae3745db384e23db8ccd36f09ee2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This script will apply an incremental refresh policy to generate | |
## empty partitions for that policy using a Service Principal via the XMLA endpoint | |
$workspace = "XMLA%20Test" | |
$databaseName = "Adv Works Inc Refresh Base" | |
$tableName = "Internet Sales" | |
$clientID = "<Your SPN Client ID>" | |
$tenantID = "<Your TenantID>" | |
$clientSecret = "<Your SPN Secret>" | |
## | |
$connStr = "Data Source=powerbi://api.powerbi.com/v1.0/myorg/$workspace;User ID=app:$($clientID)@$($tenantID);Password=$clientSecret" | |
## Load AMO - via loading the SqlServer module | |
import-module SqlServer | |
## connect to the XMLA endpoint | |
$server = new-object Microsoft.AnalysisServices.Tabular.Server | |
$server.Connect($connStr) | |
$db = $server.Databases.FindByName($databaseName) | |
$table = $db.Model.Tables[$tableName] | |
"Initial Partition count: $($table.Partitions.Count)" | |
$table.ApplyRefreshPolicy($false, 1) | |
"Final Partition count: $($table.Partitions.Count)" | |
$server.Disconnect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment