Skip to content

[Key Vault] az keyvault create: Fix keyvault create RequestDisallowedByPolicy error by explicitly setting enableSoftDelete in the request body#33265

Open
rahulalapati43 wants to merge 6 commits intoAzure:devfrom
rahulalapati43:fix/keyvault-soft-delete-policy
Open

[Key Vault] az keyvault create: Fix keyvault create RequestDisallowedByPolicy error by explicitly setting enableSoftDelete in the request body#33265
rahulalapati43 wants to merge 6 commits intoAzure:devfrom
rahulalapati43:fix/keyvault-soft-delete-policy

Conversation

@rahulalapati43
Copy link
Copy Markdown

Explicitly set enableSoftDelete=True in the request body for az keyvault create to satisfy Azure Policy checks that require the property to be present.

Related command
az keyvault create

Description
Explicitly set enableSoftDelete=True in the VaultProperties constructor when creating a Key Vault. While soft delete is already enabled by default on the service side, Azure Policy checks may require the property to be explicitly present in the
request body. Without it, az keyvault create fails with a RequestDisallowedByPolicy error when such policies are enforced. This is a non-breaking fix — no new parameters are exposed and customer behavior is unchanged.

Testing Guide

Basic vault creation (should succeed without RequestDisallowedByPolicy)

az keyvault create --name --resource-group --location

Verify soft delete is enabled on the created vault

az keyvault show --name --query "properties.enableSoftDelete"

Expected: true

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

Explicitly set enableSoftDelete=True in the request body for az keyvault create
to satisfy Azure Policy checks that require the property to be present.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @rahulalapati43,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Breaking Change Starting...

Thanks for your contribution!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates az keyvault create to explicitly include enableSoftDelete in the Key Vault create request body so Azure Policy checks that require the property won’t block vault creation.

Changes:

  • Explicitly sets enable_soft_delete=True when constructing VaultProperties for vault creation.
  • Adds a release note entry describing the policy-related fix for az keyvault create.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/azure-cli/azure/cli/command_modules/keyvault/custom.py Forces enable_soft_delete=True into the vault create payload to satisfy Azure Policy evaluation.
src/azure-cli/HISTORY.rst Documents the Key Vault create policy fix in release history.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/azure-cli/azure/cli/command_modules/keyvault/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/keyvault/custom.py
Comment thread src/azure-cli/HISTORY.rst Outdated
@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 24, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

rahulalapati43 and others added 2 commits April 24, 2026 13:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Rahul Alapati and others added 3 commits April 24, 2026 14:52
…request

Verify that the VaultProperties model passed to the SDK explicitly includes
enable_soft_delete=True, so Azure Policy checks requiring this property in
the request body are satisfied and the fix does not regress silently.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yonzhan yonzhan assigned notyashhh and unassigned evelyn-ys Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-identity-squad Auto-Assign Auto assign by bot KeyVault az keyvault

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants