Create a Cognitive Services resource using the Azure portal

Use this quickstart to start using Azure Cognitive Services. After creating a Cognitive Service resource in the Azure portal, you'll get an endpoint and a key for authenticating your applications.

You can access Azure Cognitive Services through two different resources: A multi-service resource, or a single-service one.

  • Multi-service resource:
    • Access multiple Azure Cognitive Services with a single key and endpoint.
    • Consolidates billing from the services you use.
  • Single-service resource:
    • Access a single Azure Cognitive Service with a unique key and endpoint for each service created.
    • Use the free tier to try out the service.

Prerequisites

Create a new Azure Cognitive Services resource

  1. Create a resource.

    The multi-service resource is named Cognitive Services in the portal. Create a Cognitive Services resource.

    At this time, the multi-service resource enables access to the following Cognitive Services:

    Computer Vision Content Moderator Face Language Understanding (LUIS) Text Analytics
    Translator Text Bing Search v7
    (Web, Image, News, Video, Visual)
    Bing Custom Search Bing Entity Search Bing Autosuggest
    Bing Spell Check
  2. On the Create page, provide the following information:

    Name A descriptive name for your cognitive services resource. For example, MyCognitiveServicesResource.
    Subscription Select one of your available Azure subscriptions.
    Location The location of your cognitive service instance. Different locations may introduce latency, but have no impact on the runtime availability of your resource. Remember your Azure location, as you may need it when calling the Azure Cognitive Services.
    Pricing tier The cost of your Cognitive Services account depends on the options you choose and your usage. For more information, see the API pricing details.
    Resource group The Azure resource group that will contain your Cognitive Services resource. You can create a new group or add it to a pre-existing group.

    Resource creation screen

    Click Create.

Get the keys for your resource

  1. After your resource is successfully deployed, click on Go to resource under Next Steps.

    Search for Cognitive Services

  2. From the quickstart pane that opens, you can access your key and endpoint.

    Get key and endpoint

Configure an environment variable for authentication

Applications need to authenticate access to the Cognitive Services they use. To authenticate, we recommend creating an environment variable to store the keys for your Azure Resources.

After you have your key, write it to a new environment variable on the local machine running the application. To set the environment variable, open a console window, and follow the instructions for your operating system. Replace your-key with one of the keys for your resource.

setx COGNITIVE_SERVICE_KEY "your-key"

After you add the environment variable, you may need to restart any running programs that will need to read the environment variable, including the console window. For example, if you are using Visual Studio as your editor, restart Visual Studio before running the example.

Clean up resources

If you want to clean up and remove a Cognitive Services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources contained in the group.

  1. In the Azure portal, expand the menu on the left side to open the menu of services, and choose Resource Groups to display the list of your resource groups.
  2. Locate the resource group containing the resource to be deleted
  3. Right-click on the resource group listing. Select Delete resource group, and confirm.

See also