如何检查Microsoft Azure KeyVault是否存在?我正在通过PowerShell使用以下脚本创建新的KeyVault
$vaultName = "kv3"
Set-AzureRmContext -Subscription "yyyy-f48c-4e0c-80f4-cxxxx"
New-AzureRmKeyVault -VaultName $vaultName -ResourceGroupName 'bogl' -Location 'North Europe'
$secretvalue = ConvertTo-SecureString '4444' -AsPlainText -Force
$secret = Set-AzureKeyVaultSecret -VaultName $vaultName -Name 'mySecret' -SecretValue $secretvalue
--> Check if KeyVault was successfully created/deployment process was finished or wait ...
$status = Get-AzureRMKeyVault -VaultName $vaultName
Write-Host $status
当KeyVault的部署过程需要更长的时间并且KeyVault尚不可用时,我要等待几秒钟。
答案 0 :(得分:0)
您可以放置一个简单的循环,以测试是否创建了KV-
while (-not (Get-AzureRmKeyVault -VaultName "test-keyvault" ))
{
sleep 10
}