Skip to content

Commit f440388

Browse files
authored
Merge pull request #230527 from davidsmatlak/ds-ama-update-deploy-pwsh
Updates managed apps deployment quickstart
2 parents 519f761 + 2757dfe commit f440388

File tree

1 file changed

+198
-12
lines changed

1 file changed

+198
-12
lines changed

articles/azure-resource-manager/managed-applications/deploy-service-catalog-quickstart.md

Lines changed: 198 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,60 @@ description: Describes how to deploy a service catalog's managed application for
44
author: davidsmatlak
55
ms.author: davidsmatlak
66
ms.topic: quickstart
7-
ms.date: 03/01/2023
7+
ms.date: 03/14/2023
88
---
99

1010
# Quickstart: Deploy a service catalog managed application
1111

12-
In this quickstart, you use the definition you created in the quickstarts to [publish an application definition](publish-service-catalog-app.md) or [publish a definition with bring your own storage](publish-service-catalog-bring-your-own-storage.md) to deploy a service catalog managed application. The deployment creates two resource groups. One resource group contains the managed application and the other is a managed resource group for the deployed resource. The managed application definition deploys an App Service plan, App Service, and storage account.
12+
In this quickstart, you use the managed application definition that you created using one of the quickstart articles. The deployment creates two resource groups. One resource group contains the managed application and the other is a managed resource group for the deployed resources. The managed application definition deploys an App Service plan, App Service, and storage account.
1313

1414
## Prerequisites
1515

16-
To complete this quickstart, you need an Azure account with an active subscription. If you completed a quickstart to publish a definition, you should already have an account. Otherwise, [create a free account](https://azure.microsoft.com/free/) before you begin.
16+
- A managed application definition created with [publish an application definition](publish-service-catalog-app.md) or [publish a definition with bring your own storage](publish-service-catalog-bring-your-own-storage.md).
17+
- An Azure account with an active subscription. If you don't have an account, [create a free account](https://azure.microsoft.com/free/) before you begin.
18+
- [Visual Studio Code](https://code.visualstudio.com/).
19+
- Install the latest version of [Azure PowerShell](/powershell/azure/install-az-ps) or [Azure CLI](/cli/azure/install-azure-cli).
1720

1821
## Create service catalog managed application
1922

20-
In the Azure portal, use the following steps:
23+
The examples use the resource groups names created in the _quickstart to publish an application definition_. If you used the quickstart to _publish a definition with bring your own storage_, use those resource group names.
24+
25+
- **Publish application definition**: _packageStorageGroup_ and _appDefinitionGroup_.
26+
- **Publish definition with bring your own storage**: _packageStorageGroup_, _byosDefinitionStorageGroup_, and _byosAppDefinitionGroup_.
27+
28+
### Get managed application definition
29+
30+
# [PowerShell](#tab/azure-powershell)
31+
32+
To get the managed application's definition with Azure PowerShell, run the following commands.
33+
34+
In Visual Studio Code, open a new PowerShell terminal and sign in to your Azure subscription.
35+
36+
```azurepowershell
37+
Connect-AzAccount
38+
```
39+
40+
The command opens your default browser and prompts you to sign in to Azure. For more information, go to [Sign in with Azure PowerShell](/powershell/azure/authenticate-azureps).
41+
42+
From Azure PowerShell, get your managed application's definition. In this example, use the resource group name _appDefinitionGroup_ that was created when you deployed the managed application definition.
43+
44+
```azurepowershell
45+
Get-AzManagedApplicationDefinition -ResourceGroupName appDefinitionGroup
46+
```
47+
48+
`Get-AzManagedApplicationDefinition` lists all the available definitions in the specified resource group, like _sampleManagedApplication_.
49+
50+
Create a variable for the managed application definition's resource ID.
51+
52+
```azurepowershell
53+
$definitionid = (Get-AzManagedApplicationDefinition -ResourceGroupName appDefinitionGroup -Name sampleManagedApplication).ManagedApplicationDefinitionId
54+
```
55+
56+
You use the `$definitionid` variable's value when you deploy the managed application.
57+
58+
# [Portal](#tab/azure-portal)
59+
60+
To get the managed application's definition from the Azure portal, use the following steps.
2161

2262
1. Sign in to the [Azure portal](https://portal.azure.com).
2363
1. Select **Create a resource**.
@@ -36,14 +76,65 @@ In the Azure portal, use the following steps:
3676

3777
:::image type="content" source="./media/deploy-service-catalog-quickstart/select-service-catalog-managed-application.png" alt-text="Screenshot that shows managed application definitions that you can deploy.":::
3878

79+
---
80+
81+
### Create resource group and parameters
82+
83+
# [PowerShell](#tab/azure-powershell)
84+
85+
Create a resource group for the managed application that's used during the deployment.
86+
87+
```azurepowershell
88+
New-AzResourceGroup -Name applicationGroup -Location westus3
89+
```
90+
91+
You also need to create a name for the managed application resource group. The resource group is created when you deploy the managed application.
92+
93+
Run the following commands to create the managed resource group's name.
94+
95+
```azurepowershell
96+
$mrgprefix = 'rg-sampleManagedApplication-'
97+
$mrgtimestamp = Get-Date -UFormat "%Y%m%d%H%M%S"
98+
$mrgname = $mrgprefix + $mrgtimestamp
99+
$mrgname
100+
```
101+
102+
The `$mrgprefix` and `$mrgtimestamp` variables are concatenated to create a resource group name like _rg-sampleManagedApplication-20230310100148_ that's stored in the `$mrgname` variable. You use the `$mrgname` variable's value when you deploy the managed application.
103+
104+
You need to provide several parameters to the deployment command for the managed application. You can use a JSON formatted string or create a JSON file. In this example, we use a JSON formatted string. The PowerShell escape character for the quote marks is the backtick (`` ` ``) character. The backtick is also used for line continuation so that commands can use multiple lines.
105+
106+
The JSON formatted string's syntax is as follows:
107+
108+
```json
109+
"{ `"parameterName`": {`"value`":`"parameterValue`"}, `"parameterName`": {`"value`":`"parameterValue`"} }"
110+
```
111+
112+
For readability, the completed JSON string uses the backtick for line continuation. The values are stored in the `$params` variable that's used in the deployment command. The parameters in the JSON string are required to deploy the managed resources.
113+
114+
```powershell
115+
$params="{ `"appServicePlanName`": {`"value`":`"demoAppServicePlan`"}, `
116+
`"appServiceNamePrefix`": {`"value`":`"demoApp`"}, `
117+
`"storageAccountNamePrefix`": {`"value`":`"demostg1234`"}, `
118+
`"storageAccountType`": {`"value`":`"Standard_LRS`"} }"
119+
```
120+
121+
The parameters to create the managed resources:
122+
123+
- `appServicePlanName`: Create a plan name. Maximum of 40 alphanumeric characters and hyphens. For example, _demoAppServicePlan_. App Service plan names must be unique within a resource group in your subscription.
124+
- `appServiceNamePrefix`: Create a prefix for the plan name. Maximum of 47 alphanumeric characters or hyphens. For example, _demoApp_. During deployment, the prefix is concatenated with a unique string to create a name that's globally unique across Azure.
125+
- `storageAccountNamePrefix`: Use only lowercase letters and numbers and a maximum of 11 characters. For example, _demostg1234_. During deployment, the prefix is concatenated with a unique string to create a name globally unique across Azure. Although you're creating a prefix, the control checks for existing names in Azure and might post a validation message that the name already exists. If so, choose a different prefix.
126+
- `storageAccountType`: The default is Standard_LRS. The other options are Premium_LRS, Standard_LRS, and Standard_GRS.
127+
128+
# [Portal](#tab/azure-portal)
129+
39130
1. Provide values for the **Basics** tab and select **Next: Web App settings**.
40131

41132
:::image type="content" source="./media/deploy-service-catalog-quickstart/basics-info.png" alt-text="Screenshot that highlights the required information on the basics tab.":::
42133

43134
- **Subscription**: Select the subscription where you want to deploy the managed application.
44135
- **Resource group**: Select the resource group. For this example, create a resource group named _applicationGroup_.
45136
- **Region**: Select the location where you want to deploy the resource.
46-
- **Application Name**: Enter a name for your application. For this example, use _demoManagedApplication_.
137+
- **Application Name**: Enter a name for your managed application. For this example, use _demoManagedApplication_.
47138
- **Application resources Resource group name**: The name of the managed resource group that contains the resources that are deployed for the managed application. The default name is in the format `rg-{definitionName}-{dateTime}` but you can change the name.
48139

49140
1. Provide values for the **Web App settings** tab and select **Next: Storage settings**.
@@ -58,31 +149,114 @@ In the Azure portal, use the following steps:
58149
:::image type="content" source="./media/deploy-service-catalog-quickstart/storage-settings.png" alt-text="Screenshot that shows the information needed to create a storage account.":::
59150

60151
- **Storage account name prefix**: Use only lowercase letters and numbers and a maximum of 11 characters. For example, _demostg1234_. During deployment, the prefix is concatenated with a unique string to create a name globally unique across Azure. Although you're creating a prefix, the control checks for existing names in Azure and might post a validation message that the name already exists. If so, choose a different prefix.
61-
- **Storage account type**: Select **Change type** to choose a storage account type. The default is Standard LRS.
152+
- **Storage account type**: Select **Change type** to choose a storage account type. The default is Standard LRS. The other options are Premium_LRS, Standard_LRS, and Standard_GRS.
153+
154+
---
62155

63-
1. Review the summary of the values you selected and verify **Validation Passed** is displayed. Select **Create** to deploy the managed application.
156+
### Deploy the managed application
157+
158+
# [PowerShell](#tab/azure-powershell)
159+
160+
Run the following command to deploy the managed application from your Azure PowerShell session.
161+
162+
```azurepowershell
163+
New-AzManagedApplication `
164+
-Name "demoManagedApplication" `
165+
-ResourceGroupName applicationGroup `
166+
-Location westus3 `
167+
-ManagedResourceGroupName $mrgname `
168+
-ManagedApplicationDefinitionId $definitionid `
169+
-Kind ServiceCatalog `
170+
-Parameter $params
171+
```
172+
173+
The parameters used in the deployment command:
174+
175+
- `Name`: Specify a name for the managed application. For this example, use _demoManagedApplication_.
176+
- `ResourceGroupName`: Name of the resource group you created for the managed application.
177+
- `Location`: Specify the region to deploy the resources. For this example, use _westus3_.
178+
- `ManagedResourceGroupName`: Uses the `$mrgname` parameters value. The managed resource group is created when the managed application is deployed.
179+
- `ManagedApplicationDefinitionId`: Uses the `$definitionid` variable's value for the managed application definition's resource ID.
180+
- `Kind`: Specifies that type of managed application. This example uses _ServiceCatalog_.
181+
- `Parameter`: Uses the `$parms` variable's value in the JSON formatted string.
182+
183+
# [Portal](#tab/azure-portal)
184+
185+
Review the summary of the values you selected and verify **Validation Passed** is displayed. Select **Create** to deploy the managed application.
64186

65187
:::image type="content" source="./media/deploy-service-catalog-quickstart/summary-validation.png" alt-text="Screenshot that summarizes the values you selected and shows the status of validation passed.":::
66188

189+
---
190+
67191
## View results
68192

69193
After the service catalog managed application is deployed, you have two new resource groups. One resource group contains the managed application. The other resource group contains the managed resources that were deployed. In this example, an App Service, App Service plan, and storage account.
70194

71195
### Managed application
72196

197+
After the deployment is finished, you can check your managed application's status.
198+
199+
# [PowerShell](#tab/azure-powershell)
200+
201+
Run the following commands to check the managed application's status.
202+
203+
```azurepowershell
204+
Get-AzManagedApplication -Name demoManagedApplication -ResourceGroupName applicationGroup
205+
```
206+
207+
Expand the properties to make it easier to read the `Properties` information.
208+
209+
```azurepowershell
210+
Get-AzManagedApplication -Name demoManagedApplication -ResourceGroupName applicationGroup | Select-Object -ExpandProperty Properties
211+
```
212+
213+
# [Portal](#tab/azure-portal)
214+
73215
Go to the resource group named **applicationGroup** and select **Overview**. The resource group contains your managed application named _demoManagedApplication_.
74216

75-
:::image type="content" source="./media/deploy-service-catalog-quickstart/view-application-group.png" alt-text="Screenshot that shows the resource group that contains the managed application.":::
217+
:::image type="content" source="./media/deploy-service-catalog-quickstart/view-application-group.png" alt-text="Screenshot that shows the resource group that contains the managed application.":::
76218

77219
Select the managed application's name to get more information like the link to the managed resource group.
78220

79-
:::image type="content" source="./media/deploy-service-catalog-quickstart/view-managed-application.png" alt-text="Screenshot that shows the managed application's details and highlights the link to the managed resource group.":::
221+
:::image type="content" source="./media/deploy-service-catalog-quickstart/view-managed-application.png" alt-text="Screenshot that shows the managed application's details and highlights the link to the managed resource group.":::
222+
223+
---
80224

81225
### Managed resources
82226

227+
You can view the resources deployed to the managed resource group.
228+
229+
# [PowerShell](#tab/azure-powershell)
230+
231+
To display the managed resource group's resources, run the following command. You created the `$mrgname` variable when you created the parameters.
232+
233+
```azurepowershell
234+
Get-AzResource -ResourceGroupName $mrgname
235+
```
236+
237+
To display all the role assignments for the managed resource group.
238+
239+
```azurepowershell
240+
Get-AzRoleAssignment -ResourceGroupName $mrgname
241+
```
242+
243+
The managed application definition you created in the quickstart articles used a group with the Owner role assignment. You can view the group with the following command.
244+
245+
```azurepowershell
246+
Get-AzRoleAssignment -ResourceGroupName $mrgname -RoleDefinitionName Owner
247+
```
248+
249+
You can also list the deny assignments for the managed resource group.
250+
251+
```azurepowershell
252+
Get-AzDenyAssignment -ResourceGroupName $mrgname
253+
```
254+
255+
# [Portal](#tab/azure-portal)
256+
83257
Go to the managed resource group with the name prefix **rg-sampleManagedApplication** and select **Overview** to display the resources that were deployed. The resource group contains an App Service, App Service plan, and storage account.
84258

85-
:::image type="content" source="./media/deploy-service-catalog-quickstart/view-managed-resource-group.png" alt-text="Screenshot that shows the managed resource group that contains the resources deployed by the managed application definition.":::
259+
:::image type="content" source="./media/deploy-service-catalog-quickstart/view-managed-resource-group.png" alt-text="Screenshot that shows the managed resource group that contains the resources deployed by the managed application definition.":::
86260

87261
The managed resource group and each resource created by the managed application has a role assignment. When you used a quickstart article to create the definition, you created an Azure Active Directory group. That group was used in the managed application definition. When you deployed the managed application, a role assignment for that group was added to the managed resources.
88262

@@ -95,16 +269,28 @@ To see the role assignment from the Azure portal:
95269

96270
The role assignment gives the application's publisher access to manage the storage account. In this example, the publisher might be your IT department. The _Deny assignments_ prevents customers from making changes to a managed resource's configuration. Managed apps are designed so that customers don't need to maintain the resources. The _Deny assignment_ excludes the Azure Active Directory group that was assigned in **Role assignments**.
97271

272+
---
273+
98274
## Clean up resources
99275

100-
When your finished with the managed application, you can delete the resource groups and that removes all the resources you created. For example, in this quickstart you created the resource groups _applicationGroup_ and a managed resource group with the prefix _rg-sampleManagedApplication_.
276+
When you're finished with the managed application, you can delete the resource groups and that removes all the resources you created. For example, in this quickstart you created the resource groups _applicationGroup_ and a managed resource group with the prefix _rg-sampleManagedApplication_.
277+
278+
# [PowerShell](#tab/azure-powershell)
279+
280+
The command prompts you to confirm that you want to remove the resource group.
281+
282+
```azurepowershell
283+
Remove-AzResourceGroup -Name applicationGroup
284+
```
285+
286+
# [Portal](#tab/azure-portal)
101287

102288
1. From Azure portal **Home**, in the search field, enter _resource groups_.
103289
1. Select **Resource groups**.
104290
1. Select **applicationGroup** and **Delete resource group**.
105291
1. To confirm the deletion, enter the resource group name and select **Delete**.
106292

107-
When the resource group that contains the managed application is deleted, the managed resource group is also deleted. In this example, when _applicationGroup_ is deleted the _rg-sampleManagedApplication_ resource group is also deleted.
293+
---
108294

109295
If you want to delete the managed application definition, delete the resource groups you created in the quickstart articles.
110296

0 commit comments

Comments
 (0)