问题描述
我当前正在尝试创建一个自动化运行手册来处理Azure中的多维数据集.我已经尝试过多个像这样的PowerShell脚本:
$ AzureCred = Get-AutomationPSCredential-名称"RefreshTest"Add-AzureRmAccount-凭据$ AzureCred |空空Invoke-ProcessASDatabase-数据库名称"MKTGCube"-服务器"AzureServerName" -RefreshType完整"-凭据$ AzureCred
出现这种错误(尽管我安装了SQLServer模块).
或者这个脚本:
$ connectionName ="AzureRunAsConnection"尝试{#获取连接"AzureRunAsConnection"$ servicePrincipalConnection =获取自动化连接-名称$ connectionName登录到Azure ..."Add-AzureRmAccount`-ServicePrincipal`-TenantId $ servicePrincipalConnection.TenantId`-ApplicationId $ servicePrincipalConnection.ApplicationId`-CertificateThumbprint $ servicePrincipalConnection.CertificateThumbprint}抓住 {如果(!$ servicePrincipalConnection){$ ErrorMessage =未找到连接$ connectionName."抛出$ ErrorMessage} 别的{写错误-消息$ _.Exception抛出$ _.Exception}}##获取我们之前存储的凭据.$ cred = Get-AutomationPSCredential-名称'CredMat'##提供服务器详细信息$ ServerName ="AzureServerName"调用-ProcessASDatabase-数据库名称"MKTGCube"-服务器$ ServerName -ProcessType"ProcessFull"$ error [0] .Exception.Message$ error [0] .Exception.StackTrace
显示该错误消息.
我认为问题与凭据有关,因为我们需要提供凭据来访问源数据库,但是我不知道如何通过PowerShell脚本来实现.有什么主意吗?
非常感谢.
您需要将模块 Azure.AnalysisServices
和 SqlServer
导入您的自动化帐户.
您可以从此
注意:您的脚本有误.您应该使用 Login-AzureASAccount
而不是 Add-AzureRmAccount
进行登录,您可以使用以下示例:
$ Conn = Get-AutomationConnection-名称AzureRunAsConnectionAdd-AzureAnalysisServicesAccount -RolloutEnvironment"southcentralus.asazure.windows.net" -ServicePrincipal -ApplicationId $ Conn.ApplicationID -CertificateThumbprint $ Conn.CertificateThumbprint -TenantId $ Conn.TenantID调用ProcessTable-服务器"asazure://southcentralus.asazure.windows.net/myserver" -TableName"MyTable"-数据库"MyDb" -RefreshType"Full"
有关此的更多信息,请检查此博客.
I'm currently trying to create an automation runbook to process a cube in Azure. I've tried multiple PowerShell scripts like this one :
$AzureCred = Get-AutomationPSCredential -Name "RefreshTest"
Add-AzureRmAccount -Credential $AzureCred | Out-Null
Invoke-ProcessASDatabase -databasename "MKTGCube" -server "AzureServerName" -RefreshType "Full" -Credential $AzureCred
With that kind of error (despite the fact that I installed the SQLServer module).
Or this script :
$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
With that error message.
I think the problem is linked to the credentials because we need to provide ones to access the source database but I have no ideas on how to do it through a PowerShell script. Any idea ?
Thanks a lot.
You need import module Azure.AnalysisServices
and SqlServer
to your automation account.
You could import these two module from this link and this link.
Note: There is a mistake in your script. You should use Login-AzureASAccount
not Add-AzureRmAccount
to login, you could use the following example:
$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"
More information about this please check this blog.
这篇关于使用Azure SSAS中的自动化帐户刷新多维数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!