Exercise - Create an Azure AI services account

Completed 100 XP

This module requires a sandbox to complete. A sandbox gives you access to free resources. Your personal subscription will not be charged. The sandbox may only be used to complete training on Microsoft Learn. Use for any other reason is prohibited, and may result in permanent loss of access to the sandbox.

Microsoft provides this lab experience and related content for educational purposes. All presented information is owned by Microsoft and intended solely for learning about the covered products and services in this Microsoft Learn module.

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

  1. In the Cloud Shell window on the right side of the screen, select the More icon (...), then select Settings > Go to Classic version.

  2. 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:

    Bash
    RESOURCEGROUP=[sandbox resource group name]
    
  3. Create another variable to hold the region where your resource group is located:

    Bash
    LOCATION=$(az group show --name $RESOURCEGROUP | jq -r '.location')
    
  4. 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:

    Bash
    echo $LOCATION
    
  5. Create another variable to contain your account name:

    Bash
    ACCOUNT=learn-account-$RANDOM
    
  6. Create your Azure AI services account:

    Azure CLI
    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.

    See az 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.

    See az 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:

    JSON
    {
      "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:

Azure CLI
az cognitiveservices account keys list \
   --name $ACCOUNT \
   --resource-group $RESOURCEGROUP

You should see a JSON response like the following example:

JSON
{
   "key1": "0123456789abcdef0123456789abcdef",
   "key2": "fedcba9876543210fedcba9876543210"
}

Copy the value for either key; you'll use that key when you create your application in a later exercise.


Next unit: Create a single-shot recognition speech to text application

Previous Next