How to set or change tags on an existing keyvault object with az cli command

Phillip van Ee 1 Reputation point

It seems you can only set/add them during creation
If you use az keyvault create on an existing keyvault, you get a message that it already exists (no update possibility with this command?)
Using az keyvault update it just fails, either [a] with error or [b] without an error and just showing all propsties (like a show subcommand)

Tried many combinations and failed, it really doesn't work the same with other azure objects.

Tried both bash and Powershell,a s they can differ in the way hwo to quote things.

Google and the microsoft websites revealed nothing.

Manually editing via the portal is simple and the same as with other objects.

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,043 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Siva-kumar-selvaraj 15,566 Reputation points

    Hello @Phillip van Ee ,

    Thanks for reaching out.

    You can only add tags during the Key Vault creation process using Azure CLI (BASH) cmdlets but alternatively you can use Azure PowerShell or Key Vault REST API to update Tags even after vault creations, as illustrated below:

    update-AzKeyVault -Name -ResourceGroupName -Tag @{ 'Severity' = 'high'; 'IT' = "true" }


    $Tags = @{ 'Severity' = 'high'; 'cxp' = "true" } Note: This cmdlet adds a parameter in the type of System.Collections.Hashtable
    update-AzKeyVault -Name {VaultName} -ResourceGroupName {RGname} -Tag $Tags



    HTTP Method:

    Absolute Uri:{Subscription-ID}/resourceGroups/{RGname}/providers/Microsoft.KeyVault/vaults/{VaultName}?api-version=2019-09-01

    x-ms-client-request-id : 68535a96-62c0-4ce1-85d5-2af17b3102da
    accept-language : en-US

    Example Body:
    "location": "East US",
    "tags": {
    "IT": "true",
    "Severity": "high"


    Hope this was helpful.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

  2. Rodrigo Marques Teixeira 0 Reputation points

    We can set Tags, now, for Secrets in Keyvault using the Azure Portal.

    0 comments No comments