gpt4 book ai didi

Azure PS 自动化提供的订阅 "xxxx"不存在

转载 作者:行者123 更新时间:2023-12-03 04:17:16 25 4
gpt4 key购买 nike

我希望在 Azure Automation PS 作业中选择适用于我的服务原则的订阅。在本地运行以下代码工作正常,但在自动化作业中,我只收到以下错误

Provided subscription xxxx-xxxx-xxxx-xxx-xxxx does not exist.

订阅确实存在,并且当我在本地登录时服务主体可以访问它。

$id = "someid"
$pass = "somepass"

$securePass = $pass | ConvertTo-SecureString -AsPlainText -Force

$cred = new-object -TypeName System.Management.Automation.PsCredential -ArgumentList $id, $securePass

$tenantId = "someID"

Add-AzureRmAccount -Credential $cred -TenantId $tenantId -ServicePrincipal

Select-AzureRmSubscription -SubscriptionId "someID"

最佳答案

几天后,我终于解决了这个问题。

此问题已报告 here .

这是由于与Add-AzureRmAccount cmdlet 和服务主体相关的问题造成的。

正如 Hariharan 提到的,有一个解决方法可以解决此问题

$connectionAssetName = "AzureRunAsConnection"
$conn = Get-AutomationConnection -Name $ConnectionAssetName

Login-AzureRmAccount `
-ServicePrincipal `
-CertificateThumbprint $conn.CertificateThumbprint `
-ApplicationId $conn.ApplicationId `
-TenantId $conn.TenantID `
-Environment AzureGermanCloud

引用此S.O

关于Azure PS 自动化提供的订阅 "xxxx"不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51964853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com