我正在尝试使用Azure DevOps通过CICD刷新(已经)部署的表格模型的凭据。使用Invoke- PowerShell中的ASCmd刷新凭据。当我提供租户ID、App和密钥时,脚本从本地运行良好。但是,当我从Azure运行它时,它会失败--当用户界面不可用时,需要用户ID和密码。下面是脚本:
$azureTenantId= "TenantId"
$azurePassword = ConvertTo-SecureString "Key" -AsPlainText -Force
$azureAplicationId ="AppID"
$psCred = New-Object System.Management.Automation.PSCredential($azureAplicationId , $azurePassword)
Connect-AzAccount -Credential $psCred -TenantId $azureTenantId -ServicePrincipal
Invoke-ASCmd `
-Server "AnalysisServerName" `
-Database "AdventureWorks" `
-Query "{
""createOrReplace"": {
""object"": {
""database"": ""AdventureWorks"",
""dataSource"": ""AzureBlobs/https://abc blob core windows net/""
},
""dataSource"": {
""type"": ""structured"",
""name"": ""AzureBlobs/https://abc blob core windows net/"",
""connectionDetails"": {
""protocol"": ""azure-blobs"",
""address"": {
""account"": ""abc"",
""domain"": ""blob.core.windows.net""
},
""authentication"": null,
""query"": null
},
""credential"": {
""AuthenticationKind"": ""Key"",
""kind"": ""AzureBlobs"",
""path"": ""https://abc.blob.core.windows.net/"",
""PrivacySetting"": ""Organizational"",
""Key"": ""Key""
}
}
}
}" 发布于 2020-09-23 05:25:27
Import-Module Azure.AnalysisServices
$azureappid ="tesappid"
$azureTenantId= "testid"
[ValidateNotNullOrEmpty()] $userPassword = "testpwd"
$userPassword = ConvertTo-SecureString -String $userPassword -AsPlainText -Force
$userCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $azureappid, $userPassword
Add-AzureAnalysisServicesAccount -RolloutEnvironment 'eastus.asazure.windows.net' -Credential $userCredential -TenantId $azureTenantId -ServicePrincipal
Invoke-Ascmd ....发布于 2020-09-22 03:53:23
您可以尝试使用Add-AzureAnalysisServicesAccount登录到Analysis服务器的实例。见下文:
$psCred = New-Object System.Management.Automation.PSCredential($azureAplicationId , $azurePassword)
Add-AzureAnalysisServicesAccount -RolloutEnvironment 'eastus.asazure.windows.net' -Credential $psCred -TenantId $azureTenantId -ServicePrincipal
Invoke-ASCmd ...有关更多信息,请查看文档添加-AzureAnalysisServicesAccount Add。请参见类似的线程。
您还可以尝试为Invoke命令提供凭据:
Invoke-ASCmd -Server "" -Database "" -Credential $psCred -TenantId $azureTenantId -ServicePrincipal -Query ""https://stackoverflow.com/questions/63997541
复制相似问题