Azure Runbook:使用什么凭据?

Azure Runbook : What credential to use?

我正在尝试创建一个运行手册来重新启动我的网络应用程序。我是新手,所以我在自动化 blade 中创建了一个凭据,但我不知道 username/pwd 应该是什么?和我的天蓝色登录帐户一样吗? 试过了,显然当我测试 runbook 时出现了这个错误:

Add-AzureAccount : unknown_user_type: Unknown User Type
At RestartJob:13 char:13
+ + CategoryInfo          : CloseError: (:) [Add-AzureAccount], 

AadAuthenticationFailedException
   + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount

也在尝试在 msdn 上解决这个问题。有什么帮助吗?

根据你的描述,我是在实验室测试的。 fowwling cmdlet 对我有用。

$ConnectionAssetName = "shuitest"

# Get the connection
$connection = Get-AutomationConnection -Name $connectionAssetName        

# Authenticate to Azure with certificate
Write-Verbose "Get connection asset: $ConnectionAssetName" -Verbose
$Conn = Get-AutomationConnection -Name $ConnectionAssetName
if ($Conn -eq $null)
{
    throw "Could not retrieve connection asset: $ConnectionAssetName. Assure that this asset exists in the Automation account."
}

$CertificateAssetName = $Conn.CertificateAssetName
Write-Verbose "Getting the certificate: $CertificateAssetName" -Verbose
$AzureCert = Get-AutomationCertificate -Name $CertificateAssetName
if ($AzureCert -eq $null)
{
    throw "Could not retrieve certificate asset: $CertificateAssetName. Assure that this asset exists in the Automation account."
}

Write-Verbose "Authenticating to Azure with certificate." -Verbose
Set-AzureSubscription -SubscriptionName $Conn.SubscriptionName -SubscriptionId $Conn.SubscriptionID -Certificate $AzureCert 
Select-AzureSubscription -SubscriptionId $Conn.SubscriptionID

在执行 Runbook 之前,您应该在 Azure 门户上创建资产名称和证书。

1.Certificate Azure 自动化中的资产

请selectyour runbook-->ASSETS--Certificate

2.Create 连接(资产名称)。请selectyour runbook-->ASSETS--Connections。根据你的情况,你应该 select AzureClassicCertificate