Azure Analysis Services PowerShell Reference
The Azure Analysis Services PowerShell module provides cmdlets to manage your Azure Analysis Services instances and their resources. This module allows for automation and scripting of common administrative tasks.
Installation
To install the Azure Analysis Services PowerShell module, open an elevated PowerShell prompt and run the following command:
Install-Module -Name AnalysisServices
Connecting to Azure Analysis Services
You can connect to your Azure Analysis Services instance using the Connect- AASServer cmdlet. You will need to provide the server name. You can also specify your Azure tenant ID for more explicit connections.
Connect-AASServer -Server 'your_analysis_services_server_name.windows.net'
After connecting, you can list available servers or databases.
Common Cmdlets
Server Management
Get-AasServer: Retrieves information about an Analysis Services server.New-AasServer: Creates a new Analysis Services server.Remove-AasServer: Deletes an Analysis Services server.Set-AasServer: Configures properties of an Analysis Services server.
Database Management
Get-AasDatabase: Retrieves information about an Analysis Services database.New-AasDatabase: Creates a new Analysis Services database.Remove-AasDatabase: Deletes an Analysis Services database.Restore-AasDatabase: Restores an Analysis Services database from a backup.
Permissions Management
Add-AasRoleMember: Adds a user or group to a role within an Analysis Services database.Remove-AasRoleMember: Removes a user or group from a role.Get-AasRole: Retrieves information about roles in a database.
Example: Deploying a Model
You can use PowerShell to automate the deployment of your Analysis Services models. The following example demonstrates how to deploy a tabular model from a BACPAC file.
# Connect to the server
connect-AasServer -Server 'myAASServer.eastus.asazure.windows.net'
# Define variables
$resourceGroupName = "myResourceGroup"
$serverName = "myAASServer"
$databaseName = "myDatabase"
$bacpacFilePath = "C:\path\to\your\model.bacpac"
# Restore the database from BACPAC
Restore-AasDatabase -Server $serverName -DatabaseName $databaseName -ResourceGroupName $resourceGroupName -Source $bacpacFilePath -Edition Premium -Capacity 500