Create a managed application definition with Azure CLI

This script publishes a managed application definition to a 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 trial account before you begin.

Sample script

#!/bin/bash

# Create resource group
az group create --name appDefinitionGroup --location chinaeast

# Get Azure Active Directory group to manage the application
groupid=$(az ad group show --group appManagers --query objectId --output tsv)

# Get role
roleid=$(az role definition list --name Owner --query [].name --output tsv)

# Create the definition for a managed application
az managedapp definition create \
  --name "ManagedStorage" \
  --location "chinaeast" \
  --resource-group appDefinitionGroup \
  --lock-level ReadOnly \
  --display-name "Managed Storage Account" \
  --description "Managed Azure Storage Account" \
  --authorizations "$groupid:$roleid" \
  --package-file-uri "https://raw.githubusercontent.com/Azure/azure-managedapp-samples/master/Managed%20Application%20Sample%20Packages/201-managed-storage-account/managedstorage.zip"

Script explanation

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

Command Notes
az managedapp definition create Create a managed application definition. Provide the package that contains the required files.

Next steps