Skip to content

Commit

Permalink
Digital Twins: added systemAssignedMIPrincipalId output and correspon…
Browse files Browse the repository at this point in the history
…ding test
  • Loading branch information
krbar committed Nov 14, 2023
1 parent 2cf11a3 commit 313a0fd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions modules/digital-twins/digital-twins-instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ module digitalTwinsInstance 'br:bicep/modules/digital-twins.digital-twins-instan
name: 'myCustomLockName'
}
managedIdentities: {
systemAssigned: true
userAssignedResourcesIds: [
'<managedIdentityResourceId>'
]
Expand Down Expand Up @@ -226,6 +227,7 @@ module digitalTwinsInstance 'br:bicep/modules/digital-twins.digital-twins-instan
},
"managedIdentities": {
"value": {
"systemAssigned": true,
"userAssignedResourcesIds": [
"<managedIdentityResourceId>"
]
Expand Down Expand Up @@ -998,6 +1000,7 @@ Resource tags.
| `name` | string | The name of the Digital Twins Instance. |
| `resourceGroupName` | string | The name of the resource group the resource was created in. |
| `resourceId` | string | The resource ID of the Digital Twins Instance. |
| `systemAssignedMIPrincipalId` | string | The principal ID of the system assigned identity. |

## Cross-referenced modules

Expand Down
3 changes: 3 additions & 0 deletions modules/digital-twins/digital-twins-instance/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ output hostname string = digitalTwinsInstance.properties.hostName
@description('The location the resource was deployed into.')
output location string = digitalTwinsInstance.location

@description('The principal ID of the system assigned identity.')
output systemAssignedMIPrincipalId string = (managedIdentities.?systemAssigned ?? false) && contains(digitalTwinsInstance.identity, 'principalId') ? digitalTwinsInstance.identity.principalId : ''

// =============== //
// Definitions //
// =============== //
Expand Down
9 changes: 8 additions & 1 deletion modules/digital-twins/digital-twins-instance/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.23.1.45101",
"templateHash": "2749842619084568076"
"templateHash": "7414042721706079453"
},
"name": "Digital Twins Instances",
"description": "This module deploys an Azure Digital Twins Instance.",
Expand Down Expand Up @@ -1831,6 +1831,13 @@
"description": "The location the resource was deployed into."
},
"value": "[reference('digitalTwinsInstance', '2023-01-31', 'full').location]"
},
"systemAssignedMIPrincipalId": {
"type": "string",
"metadata": {
"description": "The principal ID of the system assigned identity."
},
"value": "[if(and(coalesce(tryGet(parameters('managedIdentities'), 'systemAssigned'), false()), contains(reference('digitalTwinsInstance', '2023-01-31', 'full').identity, 'principalId')), reference('digitalTwinsInstance', '2023-01-31', 'full').identity.principalId, '')]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ module testDeployment '../../../main.bicep' = {
enableDefaultTelemetry: enableDefaultTelemetry
name: '${namePrefix}${serviceShort}001'
managedIdentities: {
systemAssigned: true
userAssignedResourcesIds: [
nestedDependencies.outputs.managedIdentityResourceId
]
Expand Down

0 comments on commit 313a0fd

Please sign in to comment.