Quickstart: Create a service connection in App Service with the Azure CLI

This quickstart describes the steps for creating a service connection in Azure App Service with the Azure CLI.

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

Prerequisites

  • This quickstart requires version 2.30.0 or higher of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
  • This quickstart assumes that you already have at least an App Service running on Azure. If you don't have an App Service, create one.

Initial set-up

  1. If you're using Service Connector for the first time, start by running the command az provider register to register the Service Connector resource provider.

    az provider register -n Microsoft.ServiceLinker
    

    Tip

    You can check if the resource provider has already been registered by running the command az provider show -n "Microsoft.ServiceLinker" --query registrationState. If the output is Registered, then Service Connector has already been registered.

  2. Optionally, use the Azure CLI az webapp connection list-support-types command to get a list of supported target services for App Service.

    az webapp connection list-support-types --output table
    

Create a service connection

Important

Using Managed Identity requires you have the permission to Microsoft Entra role assignment. Without this permission, creating a connection will fail. You can ask your subscription owner to grant you this permission or use an access key to create the connection.

Use the Azure CLI az webapp connection command to create a service connection to a Blob Storage with a system-assigned Managed Identity, providing the following information:

  • The name of the resource group that contains the App Service
  • The name of the App Service
  • The name of the resource group that contains the storage account
  • The name of the storage account
az webapp connection create storage-blob

Note

If you don't have a Blob Storage, you can run az webapp connection create storage-blob --new --system-identity to provision a new Blob Storage resource and directly connected it to your App Service instance.

View connections

Run the Azure CLI az webapp connection command to list connections to your App Service, providing the following information:

  • The name of the resource group that contains the App Service
  • The name of the App Service
az webapp connection list -g "<your-app-service-resource-group>" -n "<your-app-service-name>" --output table

Next steps

Follow the tutorials below to start building your own application with Service Connector.