尝试通过Azure PowerShell函数创建KeyVault密钥时我遇到不一致的行为。看起来,在不同的功能主机上运行相同的PowerShell将返回不同的结果/失败。失败是以下的变体:通过Azure PowerShell函数创建KeyVault密钥时的行为不一致
_Get-AzureRmKeyVault:您Azure的凭证尚未建立或已经过期,请登录运行,AzureRmAccount设置您的Azure的凭据。
该脚本旨在通过Azure AD服务负责人向Azure进行身份验证,获取相关的KeyVault并在其中创建密钥。但是,即使在对所有值进行故障排除时进行硬编码,不同功能主机之间仍然存在不一致性,即成功创建KeyVault密钥,而另一个失败。
$ServicePrincipalPassword = ConvertTo-SecureString "password" -AsPlainText -Force
$ServicePrincipalCredential = New-Object System.Management.Automation.PSCredential ($ServicePrincipalAppId, $ServicePrincipalPassword)
$Login = Login-AzureRmAccount -ServicePrincipal -TenantId $TenantId -Credential $ServicePrincipalCredential
$KeyVault = Get-AzureRmKeyVault -VaultName "testkeyvault"
write-output "$($KeyVault.VaultURI)"
$Key = Add-AzureKeyVaultKey -VaultName $KeyVault.VaultName -Name 'testkey' -Destination Software
$KeyUrl = $Key.id.Substring(0, $Key.id.LastIndexOf("/"))
Write-Output $KeyUrl
这是行为预期还是我能做的任何事情来使经验一致? 谢谢。
道歉,我不确定在哪里最好记录/跟踪问题。当前的建议是否将功能迁移到Azure自动化,直到Azure PowerShell功能未被归类为“实验性”? –
不用担心。如果您可以跟踪Ling在github上链接的问题,那会很棒。她比我在功能方面的知识要多。 – ahmelsayed