01 Run account list command (Windows/macOS/Linux) with custom output filters to list the IDs of the cloud subscriptions available in your Azure cloud account:
az account list
--query '[*].id'
02 The command output should return the requested subscription identifiers (IDs):
[
"abcdabcd-1234-abcd-1234-abcdabcdabcd",
"abcd1234-abcd-1234-abcd-abcd1234abcd"
]
03 Run account set command (Windows/macOS/Linux) with the ID of the Azure cloud subscription that you want to examine as the identifier parameter to set the selected subscription to be the current active subscription (the command does not produce an output):
az account set
--subscription abcdabcd-1234-abcd-1234-abcdabcdabcd
04 Run cognitiveservices account list command (Windows/macOS/Linux) with custom output filters to list the name and the associated resource group for each Azure AI Services (AI Foundry) instance available within the current subscription:
az cognitiveservices account list
--output table
--query '[?(kind==`AIServices`)].{name:name, resourceGroup:resourceGroup}'
05 The command output should return the requested AI Foundry instance identifiers:
Name ResourceGroup
------------------------------- ------------------------------
cc-project5-ai-service-instance cloud-shell-storage-westeurope
cc-project5-ai-foundry-instance cloud-shell-storage-westeurope
06 Run cognitiveservices account keys list command (Windows/macOS/Linux) with the name of the Azure AI Foundry instance that you want to examine as the identifier parameter, to describe the API access keys created for the selected instance:
az cognitiveservices account keys list
--name cc-project5-ai-service-instance
--resource-group cloud-shell-storage-westeurope
07 The command output should return the API access keys available for your AI Foundry instance:
{
"key1": "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234",
"key2": "1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd"
}
08 Regenerating your API access keys can affect the applications that are dependent on these keys. To initiate the regeneration process, you must first configure your applications to use the secondary key (i.e. "key2" attribute value) for continued access to the service. Run cognitiveservices account keys regenerate command (Windows/macOS/Linux) to regenerate the primary API access key (i.e. "key1" value):
az cognitiveservices account keys regenerate
--name cc-project5-ai-service-instance
--resource-group cloud-shell-storage-westeurope
--key-name key1
09 The command output should return the API access keys available for your Azure AI Foundry instance, including the newly generated key:
{
"key1": "1234123412341234123412341234123412341234123412341234123412341234",
"key2": "1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd"
}
10 Once the new primary access key is generated, configure your applications to reference the new access key ("key1" attribute value).
11 Run cognitiveservices account keys regenerate command (Windows/macOS/Linux) to regenerate the secondary API access key ("key2" value):
az cognitiveservices account keys regenerate
--name cc-project5-ai-service-instance
--resource-group cloud-shell-storage-westeurope
--key-name key2
12 The command output should return the new API access keys generated for your OpenAI instance:
{
"key1": "1234123412341234123412341234123412341234123412341234123412341234",
"key2": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
}