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

标签 powershell azure azure-powershell ssas-tabular azure-analysis-services

我目前正在尝试创建一个自动化 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.AnalysisServicesSqlServer 导入到您的自动化帐户。

您可以从此 link 导入这两个模块还有这个link .

enter image description here

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

相关文章:

Powershell switch 语句不适用于 or 运算符

powershell - 使用 PowerShell SOAP 的 HP Warranty Lookup

html - PowerShell-将变量传递到HTML输出-单独的行

powershell - 与 Microsoft Azure AD 模块 PowerShell 和 Microsoft Azure Powershell 的不同之处

azure - Az CLI - 注册 Azure AD B2C 应用程序

powershell - 使用PowerShell更改AD中电话号码的格式

sockets - Azure VM TCP 空闲超时

c# - Azure Blob 存储 - 上传速度非常慢

python - 如何从 Python Azure 存储下载 Blob 图像并从中创建图像对象?

powershell - 删除 VM 后从 Azure 资源管理器中删除 VHD