01 Run cognitiveservices account list command (Windows/macOS/Linux) with custom output filters to list the name and the associated resource group for each Azure OpenAI service instance available in the current subscription:
az cognitiveservices account list
--output table
--query '[?(kind==`OpenAI`)].{name:name, resourceGroup:resourceGroup}'
02 The command output should return the requested OpenAI service instance identifiers:
Name ResourceGroup
--------------------------- ------------------------------
tm-openai-project5-instance cloud-shell-storage-westeurope
tm-openai-workspace-server cloud-shell-storage-westeurope
03 Run cognitiveservices account keys list command (Windows/macOS/Linux) with the name of the Azure OpenAI service instance that you want to examine as the identifier parameter, to describe the API access keys created for the selected OpenAI resource:
az cognitiveservices account keys list
--name tm-openai-project5-instance
--resource-group cloud-shell-storage-westeurope
04 The command output should return the API access keys available for your OpenAI instance:
{
"key1": "abcd1234abcd1234abcd1234abcd1234",
"key2": "1234abcd1234abcd1234abcd1234abcd"
}
05 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 tm-openai-project5-instance
--resource-group cloud-shell-storage-westeurope
--key-name key1
06 The command output should return the API access keys available for your OpenAI instance, including the newly generated key:
{
"key1": "12341234123412341234123412341234",
"key2": "1234abcd1234abcd1234abcd1234abcd"
}
07 Once the new primary access key is generated, configure your applications to reference the new access key ("key1" attribute value).
08 Run cognitiveservices account keys regenerate command (Windows/macOS/Linux) to regenerate the secondary API access key ("key2" value):
az cognitiveservices account keys regenerate
--name tm-openai-project5-instance
--resource-group cloud-shell-storage-westeurope
--key-name key2
09 The command output should return the new API access keys generated for your OpenAI instance:
{
"key1": "12341234123412341234123412341234",
"key2": "abcdabcdabcdabcdabcdabcdabcdabcd"
}
10 Repeat steps no. 3 - 9 for each Azure OpenAI instance that you want to configure, available in the selected Azure subscription.
11 Repeat steps no. 1 – 10 for each subscription available in your Microsoft Azure cloud account.