6

I am trying to set same name to all my Key Vault in different Subscription but getting below error.

New-AzureRmKeyVault : VaultAlreadyExists: The name 'AKeyVault' is already in use.
At line:1 char:1
+ New-AzureRmKeyVault -VaultName AKeyVault -ResourceGroupName PS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [New-AzureRmKeyVault], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.NewAzureKeyVault

can someone please let me know if key vault name should be unique across all subscriptions?

Philip Pittle
  • 11,821
  • 8
  • 59
  • 123
NKDev
  • 456
  • 3
  • 8
  • 23

1 Answers1

16

Yes, the Key Vault name should be universally unique as key vault and keys/secrets inside it are accessed via https://{vault-name}.vault.azure.net URI. It's very much like storage account name. If I create a storage account by the name nkdev, then you can't use that name.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Is it universally unique across Clouds tenants, e.g. Worldwide, Germany, China etc. – Bhaskar Mar 29 '17 at 17:48
  • 1
    Nope. As the endpoints differ in these regions....so you could have a key vault with the same name in East US and US Gov. – Gaurav Mantri Mar 29 '17 at 17:52
  • 11
    what a crappy system of azure. It should be unique to a tenant and each tenant should have as much isolation as it would be when on premise. Also helps hackers to hack. Ideally the url should contain: https://{vault-name}.{tenant-name}.vault.azure.net. What a design mishap ! – user1102171 May 27 '20 at 16:52
  • Here's a link to an Azure feedback item, requesting to have key vault names being unique to a subscription: https://feedback.azure.com/d365community/idea/7477bcd4-321d-ed11-a81b-6045bd853c94 – AxD Aug 16 '22 at 07:14