Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Add userassignedidentity for EncryptionWithExternalKms (#4089)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritazh authored and jackfrancis committed Oct 22, 2018
1 parent 1f21059 commit 6e195e9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parts/k8s/kubernetesagentresourcesvmas.t
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"identity": {
"type": "userAssigned",
"userAssignedIdentities": {
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities/', variables('userAssignedID'))]":{}
"[variables('userAssignedIDReference')]":{}
}
},
{{else}}
Expand Down
2 changes: 1 addition & 1 deletion parts/k8s/kubernetesagentresourcesvmss.t
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"identity": {
"type": "userAssigned",
"userAssignedIdentities": {
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities/', variables('userAssignedID'))]":{}
"[variables('userAssignedIDReference')]":{}
}
},
{{else}}
Expand Down
19 changes: 18 additions & 1 deletion parts/k8s/kubernetesmasterresources.t
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,9 @@
{{ if UseManagedIdentity}}
"dependsOn":
[
{{if UserAssignedIDEnabled}}
"[variables('userAssignedIDReference')]"
{{else}}
{{$max := .MasterProfile.Count}}
{{$c := subtract $max 1}}
{{range $i := loop 0 $max}}
Expand All @@ -653,6 +656,7 @@
{{end}}
{{end}}
{{end}}
{{end}}
],
{{end}}
"properties": {
Expand All @@ -661,6 +665,18 @@
"enabledForTemplateDeployment": "false",
"tenantId": "[variables('tenantID')]",
{{if UseManagedIdentity}}
{{if UserAssignedIDEnabled}}
"accessPolicies":
[
{
"tenantId": "[variables('tenantID')]",
"objectId": "[reference(variables('userAssignedIDReference'), variables('apiVersionManagedIdentity')).principalId]",
"permissions": {
"keys": ["create", "encrypt", "decrypt", "get", "list"]
}
}
],
{{else}}
"accessPolicies":
[
{{$max := .MasterProfile.Count}}
Expand Down Expand Up @@ -699,6 +715,7 @@
{{end}}
{{end}}
],
{{end}}
{{else}}
"accessPolicies": [
{
Expand Down Expand Up @@ -745,7 +762,7 @@
"identity": {
"type": "userAssigned",
"userAssignedIdentities": {
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities/', variables('userAssignedID'))]":{}
"[variables('userAssignedIDReference')]":{}
}
},
{{else}}
Expand Down
1 change: 1 addition & 0 deletions parts/k8s/kubernetesmastervars.t
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"useManagedIdentityExtension": "{{ UseManagedIdentity }}",
"userAssignedID": "{{UserAssignedID}}",
"userAssignedClientID": "{{UserAssignedClientID}}",
"userAssignedIDReference": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities/', variables('userAssignedID'))]",
"useInstanceMetadata": "{{ UseInstanceMetadata }}",
"loadBalancerSku": "{{ LoadBalancerSku }}",
"excludeMasterFromStandardLB": "{{ ExcludeMasterFromStandardLB }}",
Expand Down

0 comments on commit 6e195e9

Please sign in to comment.