I am able to connect to Azure Analysis Service using my credentials in PowerShell. Can someone tell me how to connect using App Registration. I already added the App Registration as Analysis Services Admins in PowerShell (app:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx@xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
#Using My Credentials
$ServerFullName = "asazure://azureregion.asazure.windows.net/mytestanalysisservice"
$Server = New-Object Microsoft.AnalysisServices.Server
$Server.Connect($ServerFullName)
$Server.Roles.ExternalMembers
$Database = $Server.Databases.Item("adventureworks")
# Using Azure App Registration
$SubscriptionID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$TenantID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$ApplicationID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$PlainPassword = "ClientSecretValue"
$SecuredPassword = ConvertTo-SecureString $PlainPassword -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ApplicationID, $SecuredPassword
Connect-AzAccount -ServicePrincipal -SubscriptionId $SubscriptionID -TenantId $TenantID -Credential $Credential -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
$azContext = Get-AzContext
#Generate Token
$azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile
$profileClient = New-Object -TypeName Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient -ArgumentList ($azProfile)
$token = $profileClient.AcquireAccessToken($azContext.Subscription.TenantId)
#Connect to Azure Analysis Service using Token (I need help here)
$ServerFullName = "asazure://azureregion.asazure.windows.net/mytestanalysisservice"
$Server.Connect($ServerFullName)