0

我正在尝试创建一个运行手册来重新启动我的 Web 应用程序。我是新手,所以我在自动化刀片中创建了一个凭据,但我不知道用户名/密码应该是什么?我的天蓝色登录帐户也一样吗?试过了,很明显,当我测试运行手册时,会出现这个错误:

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上解决这个问题..有什么帮助吗?

4

1 回答 1

1

根据您的描述,我在实验室进行测试。fowling 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 门户上创建 AssetName 和 Certificate。

1. Azure 自动化中的证书资产

请选择your runbook--> ASSETS-- Certificate在此处输入图像描述

2.创建连接(资产名称)。请选择your runbook--> ASSETS-- Connections。根据您的情况,您应该选择AzureClassicCertificate

在此处输入图像描述

于 2017-05-01T07:40:07.037 回答