1
+ {
2
+ "$schema" : " https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#" ,
3
+ "contentVersion" : " 1.0.0.0" ,
4
+ "parameters" : {
5
+ "resource_group_region" : {
6
+ "type" : " String" ,
7
+ "metadata" : " Please select the region which has the lm resources deployed i.e the resource group and resources"
8
+ },
9
+ "LM_Company_name" : {
10
+ "type" : " String"
11
+ }
12
+ },
13
+ "variables" : {
14
+ "deploymentResourceGroupName" : " [concat('lm-logs-',parameters('LM_Company_name'),'-', replace(parameters('resource_group_region'),' ',''), '-group')]" ,
15
+ "identityDeploymentName" : " deployment-assets-except-role-assignment" ,
16
+ "managedIdentityName" : " [concat('msi-', variables('deploymentResourceGroupName'), '-deploy')]" ,
17
+ "managedIdentityId" : " [concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', variables('deploymentResourceGroupName'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', variables('managedIdentityName'))]" ,
18
+ "bootstrapRoleAssignmentId" : " [guid(subscription().id, variables('userAccessAdministratorRoleDefinitionId'),variables('managedIdentityId'))]" ,
19
+ "contributorRoleAssignmentId" : " [guid(subscription().id, variables('contributorRoleDefinitionId'),variables('managedIdentityId'))]" ,
20
+ "userAccessAdministratorRoleDefinitionId" : " [subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '18d7d88d-d35e-4fb5-a5c3-7773c20a72d9')]" ,
21
+ "contributorRoleDefinitionId" : " [subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]"
22
+ },
23
+ "resources" : [
24
+ {
25
+ "type" : " Microsoft.Resources/deployments" ,
26
+ "apiVersion" : " 2019-10-01" ,
27
+ "name" : " [variables('identityDeploymentName')]" ,
28
+ "properties" : {
29
+ "mode" : " Incremental" ,
30
+ "expressionEvaluationOptions" : {
31
+ "scope" : " inner"
32
+ },
33
+ "parameters" : {
34
+ "location" : {
35
+ "value" : " [parameters('resource_group_region')]"
36
+ },
37
+ "managedIdentityName" : {
38
+ "value" : " [variables('managedIdentityName')]"
39
+ }
40
+ },
41
+ "template" : {
42
+ "$schema" : " https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#" ,
43
+ "contentVersion" : " 1.0.0.0" ,
44
+ "parameters" : {
45
+ "location" : {
46
+ "type" : " string"
47
+ },
48
+ "managedIdentityName" : {
49
+ "type" : " string"
50
+ }
51
+ },
52
+ "variables" : {},
53
+ "resources" : [
54
+ {
55
+ "type" : " Microsoft.ManagedIdentity/userAssignedIdentities" ,
56
+ "name" : " [parameters('managedIdentityName')]" ,
57
+ "apiVersion" : " 2018-11-30" ,
58
+ "location" : " [parameters('location')]"
59
+ }
60
+ ],
61
+ "outputs" : {
62
+ "principalId" : {
63
+ "type" : " string" ,
64
+ "value" : " [reference(parameters('managedIdentityName')).principalId]"
65
+ }
66
+ }
67
+ }
68
+ },
69
+ "resourceGroup" : " [variables('deploymentResourceGroupName')]"
70
+ },
71
+ {
72
+ "type" : " Microsoft.Authorization/roleAssignments" ,
73
+ "apiVersion" : " 2020-04-01-preview" ,
74
+ "name" : " [variables('bootstrapRoleAssignmentId')]" ,
75
+ "dependsOn" : [
76
+ " [variables('identityDeploymentName')]"
77
+ ],
78
+ "properties" : {
79
+ "roleDefinitionId" : " [variables('userAccessAdministratorRoleDefinitionId')]" ,
80
+ "principalId" : " [reference(variables('identityDeploymentName')).outputs.principalId.value]" ,
81
+ "principalType" : " ServicePrincipal" ,
82
+ "scope" : " [subscription().id]"
83
+ }
84
+ },
85
+ {
86
+ "type" : " Microsoft.Authorization/roleAssignments" ,
87
+ "apiVersion" : " 2020-04-01-preview" ,
88
+ "name" : " [variables('contributorRoleAssignmentId')]" ,
89
+ "dependsOn" : [
90
+ " [variables('identityDeploymentName')]" ,
91
+ " [resourceId('Microsoft.Authorization/roleAssignments/', variables('bootstrapRoleAssignmentId'))]"
92
+ ],
93
+ "properties" : {
94
+ "roleDefinitionId" : " [variables('contributorRoleDefinitionId')]" ,
95
+ "principalId" : " [reference(variables('identityDeploymentName')).outputs.principalId.value]" ,
96
+ "principalType" : " ServicePrincipal" ,
97
+ "scope" : " [subscription().id]"
98
+ }
99
+ }
100
+ ]
101
+ }
0 commit comments