Deploy the Language Understanding (LUIS) container to Azure Container instances

Learn how to deploy the Cognitive Services LUIS container to Azure Container instances. This procedure demonstrates the creation of an Anomaly Detector resource. Then we discuss pulling the associated container image. Finally, we highlight the ability to exercise the orchestration of the two from a browser. Using containers can shift the developers' attention away from managing infrastructure to instead focusing on application development.


  • Use an Azure subscription. If you don't have an Azure subscription, create a free account before you begin.

Create a LUIS resource

  1. Sign into the Azure portal

  2. Click Create Language Understanding

  3. Enter all required settings:

    Setting Value
    Name Desired name (2-64 characters)
    Subscription Select appropriate subscription
    Location Select any nearby and available location
    Pricing Tier F0 - the minimal pricing tier
    Resource Group Select an available resource group
  4. Click Create and wait for the resource to be created. After it is created, navigate to the resource page.

  5. Collect configured endpoint and an API key, see gathering required parameters.

Gathering required parameters

There are three primary parameters for all Cognitive Services' containers that are required. The end-user license agreement (EULA) must be present with a value of accept. Additionally, both an Endpoint URL and API Key are needed.


The Endpoint URI value is available on the Azure portal Overview page of the corresponding Cognitive Service resource. Navigate to the Overview page, hover over the Endpoint, and a Copy to clipboard icon will appear. Copy and use where needed.

Gather the endpoint uri for later use

Keys {API_KEY}

This key is used to start the container, and is available on the Azure portal's Keys page of the corresponding Cognitive Service resource. Navigate to the Keys page, and click on the Copy to clipboard icon.

Get one of the two keys for later use


These subscription keys are used to access your Cognitive Service API. Do not share your keys. Store them securely, for example, using Azure Key Vault. We also recommend regenerating these keys regularly. Only one key is necessary to make an API call. When regenerating the first key, you can use the second key for continued access to the service.

Create an Azure file share

The LUIS container requires a .gz model file that is pulled in at runtime. The container must be able to access this model file via a volume mount from the Container instance. For information on creating an Azure file share, see create a file share. Take note of the Azure Storage account name, key, and file share name as you'll need them later.

Export and Upload packaged LUIS app

In order to upload the LUIS model (packaged app) to the Azure file share, you'll need to export it from the LUIS portal first . From the Azure portal, navigate to the Overview page of the storage account resource and select File shares. Select the file share name that you recently created, then select the Upload button.

Upload to file share

Upload the LUIS model file.

Create an Azure Container Instance resource from the Azure CLI

The YAML below defines the Azure Container Instance resource. Copy and paste the contents into a new file, named my-aci.yaml and replace the commented values with your own. Refer to the template format for valid YAML. Refer to the container repositories and images for the available image names and their corresponding repository. For more information of the YAML reference for Container instances, see YAML reference: Azure Container Instances.

apiVersion: 2018-10-01
location: # < Valid location >
name: # < Container Group name >
imageRegistryCredentials: # This is required when pulling a non-public image
  - server:
    username: # < The username for the preview container registry >
    password: # < The password for the preview container registry >
  - name: # < Container name >
      image: # < Repository/Image name >
      environmentVariables: # These env vars are required
        - name: eula
          value: accept
        - name: billing
          value: # < Service specific Endpoint URL >
        - name: apikey
          value: # < Service specific API key >
          cpu: 4 # Always refer to recommended minimal resources
          memoryInGb: 8 # Always refer to recommended minimal resources
        - port: 5000
  osType: Linux
  volumes: # This node, is only required for container instances that pull their model in at runtime, such as LUIS.
  - name: aci-file-share
      shareName: # < File share name >
      storageAccountName: # < Storage account name>
      storageAccountKey: # < Storage account key >
  restartPolicy: OnFailure
    type: Public
    - protocol: tcp
      port: 5000
tags: null
type: Microsoft.ContainerInstance/containerGroups


Not all locations have the same CPU and Memory availability. Refer to the location and resources table for the listing of available resources for containers per location and OS.

We'll rely on the YAML file we created for the az container create command. From the Azure CLI, execute the az container create command replacing the <resource-group> with your own. Additionally, for securing values within a YAML deployment refer to secure values.

az container create -g <resource-group> -f my-aci.yaml

The output of the command is Running... if valid, after sometime the output changes to a JSON string representing the newly created ACI resource. The container image is more than likely not be available for a while, but the resource is now deployed.


Pay close attention to the locations of public preview Azure Cognitive Service offerings, as the YAML will needed to be adjusted accordingly to match the location.

Validate that a container is running

There are several ways to validate that the container is running. Locate the External IP address and exposed port of the container in question, and open your favorite web browser. Use the various request URLs below to validate the container is running. The example request URLs listed below are http://localhost:5000, but your specific container may vary. Keep in mind that you're to rely on your container's External IP address and exposed port.

Request URL Purpose
http://localhost:5000/ The container provides a home page.
http://localhost:5000/status Requested with an HTTP GET, to validate that the container is running without causing an endpoint query. This request can be used for Kubernetes liveness and readiness probes.
http://localhost:5000/swagger The container provides a full set of documentation for the endpoints and a Try it out feature. With this feature, you can enter your settings into a web-based HTML form and make the query without having to write any code. After the query returns, an example CURL command is provided to demonstrate the HTTP headers and body format that's required.

Container's home page

Next steps

Let's continue working with Azure Cognitive Services containers.