| author | WilliamDAssafMSFT |
|---|---|
| ms.author | wiassaf |
| ms.reviewer | rotabor, alexwolf |
| ms.date | 06/01/2023 |
| ms.service | azure-sql-database |
| ms.topic | include |
| ms.custom | generated |
You can use Service Connector to create a connection between an Azure compute hosting environment and a target service using the Azure CLI. The Service Connector CLI commands automatically assign the proper role to your identity. You can learn more about Service Connector and which scenarios are supported on the overview page.
-
Retrieve the client ID of the managed identity you created using the
az identity showcommand. Copy the value for later use.az identity show --name MigrationIdentity --resource-group <resource-group> --query clientId -
Use the appropriate CLI command to establish the service connection:
If you're using an Azure App Service, use the az webapp connection command:
az webapp connection create storage-blob \ --resource-group <resource-group-name> \ --name <webapp-name> \ --target-resource-group <target-resource-group-name> \ --account <target-storage-account-name> \ --user-identity "client-id=<your-identity-client-id>" "subs-id=<your-subscription-id>"If you're using Azure Spring Apps, use the az spring connection create command to establish a service connection via Azure CLI.
az spring connection create storage-blob \ --resource-group <resource-group-name> \ --service <service-instance-name> \ --app <app-name> \ --deployment <deployment-name> \ --target-resource-group <target-resource-group> \ --account <target-storage-account-name> \ --user-identity "client-id=<your-identity-client-id>" "subs-id=<your-subscription-id>"If you're using Azure Container Apps, use the az containerapp connection command:
az containerapp connection create storage-blob \ --resource-group <resource-group-name> \ --name <containerapp-name> \ --target-resource-group <target-resource-group-name> \ --account <target-storage-account-name> \ --user-identity "client-id=<your-identity-client-id>" "subs-id=<your-subscription-id>"