我正在尝试使用 Azure DevOps 通过 CICD 刷新(已)部署的表格模型的凭据。
利用调用ASCmd在 PowerShell 中刷新凭据。当我提供租户 ID、应用程序 ID 和密钥时,该脚本在本地运行良好。但是,当我从 Azure Devops 运行它时,它失败并出现错误 - 用户界面不可用时需要用户 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""
}
}
}
}"
您可以尝试使用Add-AzureAnalysisServicesAccount
登录到 Azure Analysis Services 服务器的实例。见下文:
$psCred = New-Object System.Management.Automation.PSCredential($azureAplicationId , $azurePassword)
Add-AzureAnalysisServicesAccount -RolloutEnvironment 'eastus.asazure.windows.net' -Credential $psCred -TenantId $azureTenantId -ServicePrincipal
Invoke-ASCmd ...
检查文件添加-AzureAnalysisServicesAccount https://learn.microsoft.com/en-us/powershell/module/azurerm.analysisservices/add-azureanalysisservicesaccount?view=azurermps-5.7.0了解更多信息。看到这个类似的thread https://stackoverflow.com/questions/49507272/cube-refresh-with-automation-account-in-azure-ssas.
您还可以尝试为 Invoke-ASCmd 命令提供凭据:
Invoke-ASCmd -Server "" -Database "" -Credential $psCred -TenantId $azureTenantId -ServicePrincipal -Query ""
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)