我目前正在尝试创建一个自动化 Runbook 来处理 Azure 中的多维数据集。我尝试过多个 PowerShell 脚本,如下所示:
$AzureCred = Get-AutomationPSCredential -Name "RefreshTest"
Add-AzureRmAccount -Credential $AzureCred | Out-Null
Invoke-ProcessASDatabase -databasename "MKTGCube" -server "AzureServerName" -RefreshType "Full" -Credential $AzureCred
出现这种错误(尽管我安装了 SQLServer 模块)。
Invoke-ProcessASDatabase : The term 'Invoke-ProcessASDatabase' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
或者这个脚本:
$connectionName = "AzureRunAsConnection"
try
{
# Get the connection "AzureRunAsConnection "
$servicePrincipalConnection=Get-AutomationConnection -Name $connectionName
"Logging in to Azure..."
Add-AzureRmAccount `
-ServicePrincipal `
-TenantId $servicePrincipalConnection.TenantId `
-ApplicationId $servicePrincipalConnection.ApplicationId `
-CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint
}
catch {
if (!$servicePrincipalConnection)
{
$ErrorMessage = "Connection $connectionName not found."
throw $ErrorMessage
} else{
Write-Error -Message $_.Exception
throw $_.Exception
}
}
##Getting the credential which we stored earlier.
$cred = Get-AutomationPSCredential -Name 'CredMat'
## Providing the Server Details
$ServerName = "AzureServerName"
Invoke-ProcessASDatabase -databasename "MKTGCube" -server $ServerName –ProcessType "ProcessFull"
$error[0].Exception.Message
$error[0].Exception.StackTrace
带有该错误消息。
Invoke-ProcessASDatabase : Authentication failed: User ID and Password are required when user interface is not
available.
At line:32 char:1
Invoke-ProcessASDatabase -databasename "MKTGCube" -server $ServerName ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [Invoke-ProcessASDatabase], ArgumentException
FullyQualifiedErrorId : System.ArgumentException,Microsoft.AnalysisServices.PowerShell.Cmdlets.ProcessASDatabase
我认为问题与凭据有关,因为我们需要提供访问源数据库的凭据,但我不知道如何通过 PowerShell 脚本来做到这一点。有什么想法吗?
非常感谢。
最佳答案
您需要将模块 Azure.AnalysisServices
和 SqlServer
导入到您的自动化帐户。
注意:您的脚本中有一个错误。您应该使用 Login-AzureASAccount
而不是 Add-AzureRmAccount
登录,您可以使用以下示例:
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
Add-AzureAnalysisServicesAccount -RolloutEnvironment "southcentralus.asazure.windows.net" -ServicePrincipal -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint -TenantId $Conn.TenantID
Invoke-ProcessTable -Server "asazure://southcentralus.asazure.windows.net/myserver" -TableName "MyTable" -Database "MyDb" -RefreshType "Full"
有关此的更多信息请查看此 blog .
关于powershell - 使用 Azure SSAS 中的自动化帐户刷新多维数据集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49507272/