使用Sync-AzAnalysisServicesInstance

时间:2019-07-10 21:08:12

标签: azure powershell azure-analysis-services hybrid-runbook-worker

我们正在使用混合工作组,并且我们有一个组名称指向一个远程服务器, 现在,我想使用powershell脚本同步我的Azure分析服务器模型,是否有人可以使用powershell脚本进行连接和 同步我的模型?

1 个答案:

答案 0 :(得分:0)

欢迎来到Stackoverflow!

一旦配置了Hybrid Worker,请按照Consume with Data Factory部分中的说明创建Webhook。唯一的区别是在配置Webhook时选择 Run on> Hybrid Worker 选项。

使用Hybrid Worker的示例Webhook:

enter image description here

以下代码段是如何使用PowerShell Runbook执行Azure Analysis Services模型刷新的示例。

param
(
    [Parameter (Mandatory = $false)]
    [object] $WebhookData,

    [Parameter (Mandatory = $false)]
    [String] $DatabaseName,
    [Parameter (Mandatory = $false)]
    [String] $AnalysisServer,
    [Parameter (Mandatory = $false)]
    [String] $RefreshType
)

$_Credential = Get-AutomationPSCredential -Name "ServicePrincipal"

# If runbook was called from Webhook, WebhookData will not be null.
if ($WebhookData)
{ 
    # Retrieve AAS details from Webhook request body
    $atmParameters = (ConvertFrom-Json -InputObject $WebhookData.RequestBody)
    Write-Output "CredentialName: $($atmParameters.CredentialName)"
    Write-Output "AnalysisServicesDatabaseName: $($atmParameters.AnalysisServicesDatabaseName)"
    Write-Output "AnalysisServicesServer: $($atmParameters.AnalysisServicesServer)"
    Write-Output "DatabaseRefreshType: $($atmParameters.DatabaseRefreshType)"

    $_databaseName = $atmParameters.AnalysisServicesDatabaseName
    $_analysisServer = $atmParameters.AnalysisServicesServer
    $_refreshType = $atmParameters.DatabaseRefreshType

    Invoke-ProcessASDatabase -DatabaseName $_databaseName -RefreshType $_refreshType -Server $_analysisServer -ServicePrincipal -Credential $_credential
}
else 
{
    Invoke-ProcessASDatabase -DatabaseName $DatabaseName -RefreshType $RefreshType -Server $AnalysisServer -ServicePrincipal -Credential $_Credential
}

有关更多详细信息,请参阅“ Use a Hybrid worker with Azure Analysis Services”。

希望这会有所帮助。