Azure Managed Applications Workshop
In this lab you will deploy an Azure Managed Application, then customize that application and re-deploy it.
You must have an Azure account and an active Azure subscription to complete this lab. If you do not have an Azure subscription, you can create a free one here. You will need a credit card, but can cancel before any billing takes place.
-
If you don’t have it installed, download the Visual Studio Code editor.
-
Once you have Visual Studio Code installed, install the ARM Template extension from Microsoft.
In this exercise, you will deploy a Managed Application in the Azure portal. You’ll do this using an Azure service called the “Service Catalog.”
-
Clone this repository to your local machine.
- Create a ZIP file that contains these 2 files at the root of the ZIP.
- ama-workshop / lab-1 / begin / createUiDefinition.json
- ama-workshop / lab-1 / begin / mainTemplate.json
-
Name your ZIP file
app.zip
.Note: If you are using a Mac, it is important you don’t pick up any hidden files from your file system.
-
Browse to the Azure portal and log in.
-
Create a new Resource Group. We will call the one in this lab “MA-rg.”
-
Within the MA-rg resource group, create a storage account.
-
While going through the setup steps, use the following values.
- Storage account name > Some unique value
- Basics > Replication > Locally Redundant Storage (LRS)
- Networking > Network Connectivity > Public endpoint (all networks)
- Data Protection > Leave defaults
- Advanced > Leave defaults
- Tags > Leave defaults
-
Create a new container in blob storage.
Use the following values when creating the container.
- Name: arm-templates - Public access level: Blob
-
Click into the new container.
-
Select “Upload.”
-
Browse to app.zip and upload the file.
-
Right click the new blob and select > Properties.
-
Copy the URL to your clipboard and paste it somewhere you can get back to it later.
-
In your resource group, add a Service Catalog Managed Application Definition.
-
On the creation form, use the following values.
- Name: ma-01
- Display name: ma-01
- Package file uri: The URI you copied in the previous step
- Deployment Mode: Complete
- Lock level: None
-
Select the Create button
- From within your resource group, click the Service catalog managed application definition you just created.
- Select Deploy from definition.
- Go through the setup screens and create the managed application.
-
Once the deployment is complete, open the Remote Desktop application.
Note: You can install from the App Store if you are on a Mac. Install from the Microsoft store if you are on Windows.
-
Go to the VM you created in the Azure portal.
-
Copy its IP address and use it with Remote Desktop to remote into the machine. Use the credentials you specified during installation to log in.
-
Once logged in, just shut down the machine so you won’t be charged for VM uptime.
In this exercise, you will change the type of VM from Windows 10 to Ubuntu and, add a storage account to your application, and redeploy the application.
- Open the ARM template (mainTemplate.json) for editing.
- In the parameters section add the following 2 parameters. This will be populated by outputs of the
createUiDefinition.json
, which you will modify later.
"storageAccountPrefix": {
"type": "string",
"metadata": {
"description": "Assign a prefix for the Storage account"
}
},
"storageAccountType": {
"type": "string",
"metadata": {
"description": "Assign Storage account type"
}
}
- In the variables section, change the
osType
variable to create an Ubuntu image instead of Windows. To do so, make the osType variable JSON look like the following.
"osType": {
"imageOffer": "UbuntuServer",
"imageSku": "18.04-LTS",
"imagePublisher": "Canonical"
}
- In the variables section, add the following line.
"storageName": "[concat(parameters('storageAccountPrefix'), uniqueString(resourceGroup().id))]"
- Insert the below JSON as the last resource to be created in the ARM template. This JSON specifies that the ARM template will create a plain storage account.
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageName')]",
"apiVersion": "2019-06-01",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('storageAccountType')]"
},
"kind": "Storage",
"properties": {
"allowBlobPublicAccess": true
}
}
Here you will update the createUiDefinition.json
file to create an installation experience that prompts the user for details needed to create an Azure Storage account. The values gathered will be input into the ARM template as parameters at install time.
- Open the UI Definition file (createUiDefinition.json) for editing.
- Add the following JSON as the last member of the steps array.
{
"name": "storageBlade",
"label": "Storage",
"bladeTitle": "Storage settings",
"elements": [
{
"name": "storageAccount",
"type": "Microsoft.Storage.MultiStorageAccountCombo",
"label": {
"prefix": "Storage account name prefix",
"type": "Storage account type"
},
"defaultValue": {
"type": "Premium_LRS"
},
"toolTip": {
"prefix": "Storage account name prefix",
"type": "Storage account type"
},
"count": 2,
"visible": true
}
]
}
- Add the following 2 lines to the end of the outputs section. These are the parameter names you included in the ARM template earlier.
"storageAccountPrefix": "[steps('storageBlade').storageAccount.prefix]",
"storageAccountType": "[steps('storageBlade').storageAccount.type]"
In this section, you will download a tool used in testing ARM templates and use it to test your mainTemplate.json and createUiDefinition.json files.
-
Follow the instructions in the linked article below, using
../ama-workshop/Lab 1/begin
as the target folder. -
Fix any errors reported by the tool.
In this last exercise, you will package your new application and publish it. After that, you’ll check to see that the VM you deployed is up and running.
- Delete the old app.zip file
- ZIP the 2 files into a new file named app.zip
- Delete the old app.zip from blob storage and upload the new one
Create a new Service Catalog Managed Application definition, just as you did before. Use a new different for this definition.
Install the app just as you did before, this time using a different name for the application.
After the installation completes, the VM you created will be left in a running state.
Since it is an Ubuntu server, you would need to SSH into the box to manage it. You are free to SSH into the machine if you know how, but you can also just see in the menu bar on the VM’s portal page that it is running.
Shutdown the machine.
Congratulations, you now know how to create a simple managed application and publish it through a Service Catalog within the Azure portal.
In this lab you created an Azure Managed Application and published it to a Service Catalog. From there, you installed the application. You also enhanced the application’s ARM template and installation interface.