Skip to content

az keyvault create silently zaps existing access policy when run on existing vault #7608

@ppanyukov

Description

@ppanyukov

Describe the bug

A bug or a "feature"? Regardless, makes az keyvault create rather unsafe.

When we run az keyvault create --name=EXISTING_VAULT and EXISTING_VAULT does exist, the command succeeds. However, any access policy set up in that vault is now gone and has to be recreated again.

The az keyvault create --name=EXISTING_VAULT does not produce any warning. Neither it does allow to fail is vault already exists.

To Reproduce

  1. Run az keyvault create --name=EXISTING_VAULT
  2. Set up extensive access policy on it in Azure Portal.
  3. Run az keyvault create --name=EXISTING_VAULT again.
  4. Observe in Azure Portal the policy is now all gone and is now in default state.

Expected behavior

  1. Subsequent runs of az keyvault create --name=EXISTING_VAULT preserve all settings unless these differ as supplied by command line parameters. All access policies should be preserved. Essentially, this should be "don't change anything unless told" and should be safe to run at any times with the same command line args.

Environment summary
brew on OS X:

az --version
azure-cli (2.0.48)

Metadata

Metadata

Labels

KeyVaultaz keyvaultquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions