Deploy a managed application for service catalog with Azure CLI

This script deploys a managed application definition from the service catalog.

To run this sample, install the latest version of the Azure CLI. To start, run az login to create a connection with Azure.

Samples for the Azure CLI are written for the bash shell. To run this sample in Windows PowerShell or Command Prompt, you may need to change elements of the script.

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

Sample script

#!/bin/bash

# Create resource group
az group create --name applicationGroup --location westcentralus 

# Get ID of managed application definition
appid=$(az managedapp definition show --name ManagedStorage --resource-group appDefinitionGroup --query id --output tsv)

# Get subscription ID
subid=$(az account show --query id --output tsv)

# Construct the ID of the managed resource group
managedGroupId=/subscriptions/$subid/resourceGroups/infrastructureGroup

# Create the managed application
az managedapp create \
  --name storageApp \
  --location "westcentralus" \
  --kind "Servicecatalog" \
  --resource-group applicationGroup \
  --managedapp-definition-id $appid \
  --managed-rg-id $managedGroupId \
  --parameters "{\"storageAccountNamePrefix\": {\"value\": \"demostorage\"}, \"storageAccountType\": {\"value\": \"Standard_LRS\"}}"

Script explanation

This script uses the following command to deploy the managed application. Each command in the table links to command-specific documentation.

Command Notes
az managedapp create Create a managed application. Provide the definition ID and parameters for the template.

Next steps