Setting Incremental Deployment Mode for Azure Managed App Service Catalog Definition

In this article, we take a look at how to set “Incremental” deployment mode for Service Catalog Definition for Azure Managed Application.

If you are new to Azure Managed Applications, please see this article.

When developing and testing Azure Managed Applications, I usually use the “az managedapp definition create” Azure CLI command to create the service catalog definition in my Azure subscription for testing prior to publishing in Azure Marketplace. Currently, this CLI command does not provide a way to explicitly specify the Deployment Mode (i.e. Incremental or Complete), and the default mode that the managed app definition gets is “Complete”.

In addition, current documentation for the Application Definitions — Create or Update REST API does not show how to specify the deployment mode in JSON.

Therefore, below we look at an undocumented way to set the deployment mode for our managed application definition.

Create Managed App Definition

az managedapp definition create --name "ama-definition" --location eastus --resource-group avama --lock-level ReadOnly --display-name "My Managed App Definition" --description "My Managed App Example" --authorizations "YOUR_AAD_GROUP_PRINCIPAL_ID:b24988ac-6180-42a0-ab88-20f7382dd24c" --package-file-uri "https://YOUR_STORAGE_ACCOUNT.blob.core.windows.net/ama/ama.zip"

We could also skip the step of creating Managed App Definition using the Azure CLI command and directly do a PUT, but for that we would need to construct the JSON payload by hand.

Get Managed App Definition JSON

az rest --method get --url /subscriptions/06b230b6-ec16-422c-a319-487cbe82501a/resourceGroups/avama/providers/Microsoft.Solutions/applicationDefinitions/ama-definition?api-version=2019-07-01 -o json

We get back JSON output that looks like the following and save the output to a text file like managedapp-definition.json so we can use it in PUT request later.

{
"id": "/subscriptions/06b230b6-ec16-422c-a319-487cbe82501a/resourceGroups/avama/providers/Microsoft.Solutions/applicationDefinitions/ama-definition",
"location": "eastus",
"name": "ama-definition",
"properties": {
"artifacts": [
{
"name": "ApplicationResourceTemplate",
"type": "Template",
"uri": "https://xyzl01.blob.core.windows.net/applicationdefinitions/xyz/applicationResourceTemplate.json"
},
{
"name": "CreateUiDefinition",
"type": "Custom",
"uri": "https://management.azure.com/subscriptions/06b230b6-ec16-422c-a319-487cbe82501a/resourceGroups/avama/providers/Microsoft.Solutions/applicationDefinitions/ama-definition/applicationArtifacts/CreateUiDefinition?api-version=2017-09-01"
},
{
"name": "MainTemplateParameters",
"type": "Custom",
"uri": "https://management.azure.com/subscriptions/06b230b6-ec16-422c-a319-487cbe82501a/resourceGroups/avama/providers/Microsoft.Solutions/applicationDefinitions/ama-definition/applicationArtifacts/MainTemplateParameters?api-version=2017-09-01"
}
],
"authorizations": [
{
"principalId": "fd7ae2b5-02de-4408-934b-94802f140a4c",
"roleDefinitionId": "b24988ac-6180-42a0-ab88-20f7382dd24c"
}
],
"description": "My Managed App Example",
"displayName": "My Managed App Definition",
"isEnabled": true,
"lockLevel": "ReadOnly"
},
"resourceGroup": "avama",
"type": "Microsoft.Solutions/applicationDefinitions"
}

Update Managed App via REST PUT

We also add the key snippet of JSON that sets the deployment mode to Incremental. Both of these changes are made inside of the “properties” section as follows.

"properties": {
"deploymentPolicy": {
"deploymentMode": "Incremental"
},
"packageFileUri": "https://YOUR_STORAGE_ACCOUNT.blob.core.windows.net/ama/ama.zip",
...

The final content of managedapp-definition.json file should look something like this.

{
"id": "/subscriptions/06b230b6-ec16-422c-a319-487cbe82501a/resourceGroups/avama/providers/Microsoft.Solutions/applicationDefinitions/ama-definition",
"location": "eastus",
"name": "ama-definition",
"properties": {
"deploymentPolicy": {
"deploymentMode": "Incremental"
},
"packageFileUri": "https://YOUR_STORAGE_ACCOUNT.blob.core.windows.net/ama/ama.zip",
"artifacts": [
{
"name": "ApplicationResourceTemplate",
"type": "Template",
"uri": "https://xyzl01.blob.core.windows.net/applicationdefinitions/xyz/applicationResourceTemplate.json"
},
{
"name": "CreateUiDefinition",
"type": "Custom",
"uri": "https://management.azure.com/subscriptions/06b230b6-ec16-422c-a319-487cbe82501a/resourceGroups/avama/providers/Microsoft.Solutions/applicationDefinitions/ama-definition/applicationArtifacts/CreateUiDefinition?api-version=2017-09-01"
},
{
"name": "MainTemplateParameters",
"type": "Custom",
"uri": "https://management.azure.com/subscriptions/06b230b6-ec16-422c-a319-487cbe82501a/resourceGroups/avama/providers/Microsoft.Solutions/applicationDefinitions/ama-definition/applicationArtifacts/MainTemplateParameters?api-version=2017-09-01"
}
],
"authorizations": [
{
"principalId": "fd7ae2b5-02de-4408-934b-94802f140a4c",
"roleDefinitionId": "b24988ac-6180-42a0-ab88-20f7382dd24c"
}
],
"description": "My Managed App Example",
"displayName": "My Managed App Definition",
"isEnabled": true,
"lockLevel": "ReadOnly"
},
"resourceGroup": "avama",
"type": "Microsoft.Solutions/applicationDefinitions"
}

Finally, we make the PUT call via “az rest” command to update the managed app definition with our changes.

az rest --method put --url /subscriptions/06b230b6-ec16-422c-a319-487cbe82501a/resourceGroups/avama/providers/Microsoft.Solutions/applicationDefinitions/ama-managedapp?api-version=2019-07-01 --body @managedapp-definition.json -o json

Confirm Managed App Definition was Updated

az rest --method get --url /subscriptions/06b230b6-ec16-422c-a319-487cbe82501a/resourceGroups/avama/providers/Microsoft.Solutions/applicationDefinitions/ama-definition?api-version=2019-07-01 -o json

Thank you!

Please leave feedback and questions below or on Twitter https://twitter.com/ArsenVlad

Principal Engineer / Architect, FastTrack for Azure at Microsoft