Last active
August 9, 2024 15:37
-
-
Save waldekmastykarz/19285788080b9f794d0d275f5df0b1b4 to your computer and use it in GitHub Desktop.
Create MSI with app roles assigned
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension microsoftGraph | |
resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { | |
location: resourceGroup().location | |
name: 'my-connector' | |
} | |
resource graphSp 'Microsoft.Graph/[email protected]' existing = { | |
appId: '00000003-0000-0000-c000-000000000000' | |
} | |
var graphAppRoles = graphSp.appRoles | |
resource externalConnectionReadWriteOwnedByAssignment 'Microsoft.Graph/[email protected]' = { | |
principalId: identity.properties.principalId | |
resourceId: graphSp.id | |
appRoleId: filter(graphAppRoles, r => r.value == 'ExternalConnection.ReadWrite.OwnedBy')[0].id | |
} | |
resource externalItemReadWriteOwnedByAssignment 'Microsoft.Graph/[email protected]' = { | |
principalId: identity.properties.principalId | |
resourceId: graphSp.id | |
appRoleId: filter(graphAppRoles, r => r.value == 'ExternalItem.ReadWrite.OwnedBy')[0].id | |
} | |
output identityId string = identity.properties.clientId | |
output spId string = identity.properties.principalId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment