Skip to content

Instantly share code, notes, and snippets.

@waldekmastykarz
Created August 9, 2024 15:34
Show Gist options
  • Save waldekmastykarz/fcd0bb126bdd8218d50abc50bf57d5d8 to your computer and use it in GitHub Desktop.
Save waldekmastykarz/fcd0bb126bdd8218d50abc50bf57d5d8 to your computer and use it in GitHub Desktop.
Create Entra app reg, with a service principal and admin consent using bicep
extension microsoftGraph
resource appRegistration 'Microsoft.Graph/[email protected]' = {
displayName: 'My Graph connector'
uniqueName: 'my-graph-connector'
signInAudience: 'AzureADMyOrg'
requiredResourceAccess: [
{
resourceAppId: '00000003-0000-0000-c000-000000000000'
resourceAccess: [
{
id: 'f431331c-49a6-499f-be1c-62af19c34a9d'
type: 'Role'
}
{
id: '8116ae0f-55c2-452d-9944-d18420f5b2c8'
type: 'Role'
}
]
}
]
}
resource sp 'Microsoft.Graph/[email protected]' = {
appId: appRegistration.appId
}
resource graphSp 'Microsoft.Graph/[email protected]' existing = {
appId: '00000003-0000-0000-c000-000000000000'
}
resource externalConnectionReadWriteOwnedByAssignment 'Microsoft.Graph/[email protected]' = {
principalId: sp.id
resourceId: graphSp.id
appRoleId: 'f431331c-49a6-499f-be1c-62af19c34a9d'
}
resource externalItemReadWriteOwnedByAssignment 'Microsoft.Graph/[email protected]' = {
principalId: sp.id
resourceId: graphSp.id
appRoleId: '8116ae0f-55c2-452d-9944-d18420f5b2c8'
}
output appId string = appRegistration.appId
output spId string = sp.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment