使用 Azure SSAS 中的自动化帐户刷新多维数据集

Cube refresh with Automation Account in Azure SSAS

我目前正在尝试创建一个自动化运行手册来处理 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.AnalysisServicesSqlServer 导入您的自动化帐户。

您可以从此link and this link导入这两个模块。

注意:您的脚本有错误。您应该使用 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