Search code examples
azure-clisecret-keyazure-eventgrid

Any way to to get event grid topic secret dynamically with Azure CLI?


Is there any way to get Azure Event Grid Topic secret dynamically in using Azure CLI?

enter image description here


Solution

  • I have one Azure Event Grid Topic named demoevent with below Access keys:

    enter image description here

    To get these Azure Event Grid Topic secrets dynamically using Azure CLI, you can make use of below command:

    az eventgrid topic key list --resource-group <resourceGroupName> --name <topicName>
    

    Response:

    enter image description here

    To get the value of specific key, you can use below CLI command by adding --query in it at the end:

    az eventgrid topic key list --output tsv --resource-group <resourceGroupName> --name <topicName> --query "key1"
    

    Response:

    enter image description here