Sync-AzureAnalysisServicesInstance导致在同步扩展的Azure Analysis Service实例中出现问题

时间:2018-08-15 17:09:09

标签: azure-powershell azure-automation azure-analysis-services

我一直在尝试使用命令Sync-AzureAnalysisServicesInstance同步扩展的Azure分析实例,但是,当我使用它时,建议先登录“ Add-AzureAnalysisServicesAccount” cmdlet。

我无法绕过此cmdlet,并且出现以下错误: “ Add-AzureAnalysisServicesAccount:AADSTS70002:验证凭据时出错。AADSTS50012:客户端断言包含一个 无效的签名。 [原因-找不到密钥。,客户端使用的密钥的指纹:“ xxxx-xxxx-xxxx”

代码段如下:

    workflow ScaleOut
{

    $connectionName = "AzureRunAsConnection"
    $servicePrincipalConnection=Get-AutomationConnection -Name $connectionName         

     "Logging in to Azure..."
      Add-AzureRmAccount `
       -ServicePrincipal `
       -TenantId $servicePrincipalConnection.TenantId `
       -ApplicationId $servicePrincipalConnection.ApplicationId `
       -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint     

     Select-AzureRmSubscription -SubscriptionId "aaa-bbb12-ccc"
     Set-AzureRmAnalysisServicesServer -Name "aasprakhar" -ResourceGroupName "Storage" -ReadonlyReplicaCount "1" -Administrator "SA@abcdehotmail.onmicrosoft.com"

InlineScript { 
$ApplicationCredential = Get-AutomationPSCredential -Name "SA"  
Add-AzureAnalysisServicesAccount -RolloutEnvironment "asazure://westeurope.asazure.windows.net/abcde" -ServicePrincipal  -TenantId "asf-asdf-asdcv" -ApplicationId "aaa-bb-ccc" -CertificateThumbprint "xxx-xxx-xxxx"

#Sync-AzureAnalysisServicesInstance -Instance "asazure://westeurope.asazure.windows.net/aasprakhar" -Database "adventureworks" -PassThru 

}

Can anyone please suggest what am I doing wrong here.

1 个答案:

答案 0 :(得分:0)

谢谢。我能够弄清楚。以下是用于添加帐户以登录到AS实例的代码段:

workflow ScaleOut
{

    $connectionName = "AzureRunAsConnection"
    $servicePrincipalConnection=Get-AutomationConnection -Name $connectionName         

     "Logging in to Azure..."
      Add-AzureRmAccount `
       -ServicePrincipal `
       -TenantId $servicePrincipalConnection.TenantId `
       -ApplicationId $servicePrincipalConnection.ApplicationId `
       -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint     

     Select-AzureRmSubscription -SubscriptionId "xxx-xxx-xxx"
     Set-AzureRmAnalysisServicesServer -Name "abcde" -ResourceGroupName "xxxx" 

InlineScript { 
$ApplicationCredential = Get-AutomationPSCredential -Name "SA"  

Add-AzureAnalysisServicesAccount -RolloutEnvironment: westeurope.asazure.windows.net -Credential: $ApplicationCredential

# Sync-AzureAnalysisServicesInstance -Instance asazure://westeurope.asazure.windows.net/xxxx -Database adventureworks -PassThru 

}

}