Exercise - Create an Azure AI services account
In the previous unit, you learned how to use the Azure portal to create an Azure AI services account.
In this exercise, you'll create an Azure AI services account using the Azure CLI.
The applications that you'll create in the upcoming exercises use this account to perform the speech to text operations.
Create an Azure AI services account
In the Cloud Shell window on the right side of the screen, select the More icon (...), then select Settings > Go to Classic version.
Use the following code to create a variable to hold the name of the resource group that was created for you when you activated the Learn sandbox:
RESOURCEGROUP=<rgn>[sandbox resource group name]</rgn>
Create another variable to hold the region where your resource group is located:
LOCATION=$(az group show --name $RESOURCEGROUP | jq -r '.location')
You'll need the location when you create your application, so use the following command to list the contents of the
$LOCATION
variable, then copy that value for later:echo $LOCATION
Create another variable to contain your account name:
ACCOUNT=learn-account-$RANDOM
Create your Azure AI services account:
az cognitiveservices account create \ --name $ACCOUNT \ --resource-group $RESOURCEGROUP \ --kind SpeechServices \ --sku F0 \ --location $LOCATION \ --yes
In the preceding code:
Value Description name Specifies the unique name for your Azure AI services account. resource-group Specifies the name of your resource group. kind Specifies the account type, which is SpeechServices for this exercise because we'll be creating a speech to text application.
Seeaz cognitiveservices account list-kinds
for a list of account types.sku Specifies the SKU for the account, which is the free F0 tier for this exercise.
Seeaz cognitiveservices account list-skus
for a list of account SKUs.location Specifies the location for the account. yes Suppresses the prompt for terms confirmation. This command should take a few seconds to complete. You'll get a JSON response from Azure like the following example when the command finishes:
{ "etag": "\"00000000-0000-0000-0000-000000000000\"", "id": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/learn-bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/providers/Microsoft.CognitiveServices/accounts/learn-account-33333", "identity": null, "kind": "SpeechServices", "location": "westus", "name": "learn-account-33333", "properties": { ... }, "resourceGroup": "learn-bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f", "sku": { "capacity": null, "family": null, "name": "F0", "size": null, "tier": null }, "tags": null, "type": "Microsoft.CognitiveServices/accounts" }
Retrieve the keys for your Azure AI services account
When your Azure AI services account has been created, use the following command to list the keys:
az cognitiveservices account keys list \
--name $ACCOUNT \
--resource-group $RESOURCEGROUP
You should see a JSON response like the following example:
{
"key1": "0123456789abcdef0123456789abcdef",
"key2": "fedcba9876543210fedcba9876543210"
}
Copy the value for either key; you'll use that key when you create your application in a later exercise.