Skip to content

New Key Vault creation fails due to purge protection validation error #32311

@pseckar

Description

@pseckar

Describe the bug

When creating new Key Vault with a name that does not exist, the deployment using az cli fails due to error. I am using Bicep and I am setting the enablePurgeProtection to false. Previously, I have set it to true for a vault with different name in the same resource group.

Related command

az deployment group create --resource-group <rg> --parameters <path-to-bicepparam>

Errors

The property \"enablePurgeProtection\" cannot be set to false. Enabling the purge protection for a vault is an irreversible action.

Issue script & Debug output

Part of the ARM json:

"keyVault": {
              "type": "Microsoft.KeyVault/vaults",
              "apiVersion": "2025-05-01",
              "name": "[__bicep.sanitizeResourceName(format('{0}-{1}', variables('resourcePrefix'), parameters('resourceName')))]",
              "location": "[parameters('location')]",
              "tags": "[parameters('tags')]",
              "properties": {
                "sku": {
                  "name": "standard",
                  "family": "A"
                },
                "tenantId": "[subscription().tenantId]",
                "enableRbacAuthorization": true,
                "enablePurgeProtection": false,
                "softDeleteRetentionInDays": 90
              }
            }

Expected behavior

I am able to create Key Vault with unused name and disabled purge protection.

Environment Summary

azure-cli 2.78.0

core 2.78.0
telemetry 1.1.0

Extensions:
azure-iot 0.21.5

Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users<username>.azure'
Extensions directory 'C:\Users<username>.azure\cliextensions'

Python (Windows) 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botAzure Deploymentsaz deployment/bicep/stack/deployment-scripts/ts/group exportPossible-SolutionService AttentionThis issue is responsible by Azure service team.Similar-IssuebugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions