Azure Managed Identity - Add Graph Permission

Entra ID06/23/2024

Because the topic of Managed Identity is referenced in many posts and this is standard procedure in the Function/Logic App today, I would like to demonstrate the use and assignment of graph permissions for a managed identity.

Activating Managed Identity

If we have an Azure Function or Logic App, for example, the first step is to activate the Managed Identity of the resource.

This is quite simple: we just go to the resource in Azure, go to Identity, click System Assigned, set it to On, and then save

After saving, the Object ID should appear after a few seconds. If we take this Object ID, we can now find a associated Enterprise App in the Entra ID.

Checking Graph API permissions

We want to set the appropriate Graph Permission (Application permission) on the Logic App or Function. To do this, we first need to know what permissions are available and what the exact name is.


https://graph.microsoft.com/v1.0/servicePrincipals(appId='00000003-0000-0000-c000-000000000000')?$select=id,appId,displayName,appRoles,oauth2PermissionScopes,resourceSpecificApplicationPermissions

To find out, we can use the Graph Request and the Graph App ID to list all roles and specific permissions. We then receive a JSON object with all roles.

Example response:

    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#servicePrincipals(id,appId,displayName,appRoles,oauth2PermissionScopes,resourceSpecificApplicationPermissions)/$entity",

    "id": "8b44c67b-91cc-4488-af9b-94a248357254",

    "appId": "00000003-0000-0000-c000-000000000000",

    "displayName": "Microsoft Graph",

    "appRoles": [

        {

            "allowedMemberTypes": [

                "Application"

            ],

            "description": "Allows the app to read access reviews, reviewers, decisions and settings in the organization, without a signed-in user.",

            "displayName": "Read all access reviews",

            "id": "d07a8cc0-3d51-4b77-b3b0-32704d1f69fa",

            "isEnabled": true,

            "origin": "Application",

            "value": "AccessReview.Read.All"

        },
       ........

I have exported all application permissions and provided them as a list:

App Rolevalue
Read all access reviewsAccessReview.Read.All
Manage all access reviewsAccessReview.ReadWrite.All
Manage access reviews for group and app membershipsAccessReview.ReadWrite.Membership
Read all acronymsAcronym.Read.All
Read all administrative unitsAdministrativeUnit.Read.All
Read and write all administrative unitsAdministrativeUnit.ReadWrite.All
Read all terms of use agreementsAgreement.Read.All
Read and write all terms of use agreementsAgreement.ReadWrite.All
Read all terms of use acceptance statusesAgreementAcceptance.Read.All
Read all AI enterprise interactions.AiEnterpriseInteraction.Read.All
Read API connectors for authentication flowsAPIConnectors.Read.All
Read and write API connectors for authentication flowsAPIConnectors.ReadWrite.All
Read all app catalogsAppCatalog.Read.All
Read and write to all app catalogsAppCatalog.ReadWrite.All
Read and write the remote desktop security configuration for all appsApplication-RemoteDesktopConfig.ReadWrite.All
Read all applicationsApplication.Read.All
Read and write all applicationsApplication.ReadWrite.All
Manage apps that this app creates or ownsApplication.ReadWrite.OwnedBy
Manage app permission grants and app role assignmentsAppRoleAssignment.ReadWrite.All
Read all approvalsApprovalSolution.Read.All
Read all approvals and manage approval subscriptionsApprovalSolution.ReadWrite.All
Read attack simulation data of an organizationAttackSimulation.Read.All
Read, create, and update all attack simulation data of an organizationAttackSimulation.ReadWrite.All
Read all audit log dataAuditLog.Read.All
Read audit logs data from Dynamics CRM workloadAuditLogsQuery-CRM.Read.All
Read audit logs data from Endpoint Data Loss Prevention workloadAuditLogsQuery-Endpoint.Read.All
Read audit logs data from Entra (Azure AD) workloadAuditLogsQuery-Entra.Read.All
Read audit logs data from Exchange workloadAuditLogsQuery-Exchange.Read.All
Read audit logs data from OneDrive workloadAuditLogsQuery-OneDrive.Read.All
Read audit logs data from SharePoint workloadAuditLogsQuery-SharePoint.Read.All
Read audit logs data from all servicesAuditLogsQuery.Read.All
Read all authentication context informationAuthenticationContext.Read.All
Read and write all authentication context informationAuthenticationContext.ReadWrite.All
Read all backup configuration policiesBackupRestore-Configuration.Read.All
Read and edit all backup configuration policiesBackupRestore-Configuration.ReadWrite.All
Read the status of the M365 backup serviceBackupRestore-Control.Read.All
Update or read the status of the M365 backup serviceBackupRestore-Control.ReadWrite.All
Read all monitoring, quota and billing information for the tenantBackupRestore-Monitor.Read.All
Read all restore sessionsBackupRestore-Restore.Read.All
Read restore all sessions and start restore sessions from backupsBackupRestore-Restore.ReadWrite.All
Search for metadata properties in all backup snapshotsBackupRestore-Search.Read.All
Read and write application billing configurationBillingConfiguration.ReadWrite.All
Read all BitLocker keysBitlockerKey.Read.All
Read all BitLocker keys basic informationBitlockerKey.ReadBasic.All
Manage bookings informationBookings.Manage.All
Read all Bookings related resources.Bookings.Read.All
Read and write bookings informationBookings.ReadWrite.All
Read and write all Bookings related resources.BookingsAppointment.ReadWrite.All
Read all bookmarksBookmark.Read.All
Read all browser site lists for your organizationBrowserSiteLists.Read.All
Read and write all browser site lists for your organizationBrowserSiteLists.ReadWrite.All
Read all business scenario configurations this app creates or ownsBusinessScenarioConfig.Read.OwnedBy
Read and write all business scenario configurations this app creates or ownsBusinessScenarioConfig.ReadWrite.OwnedBy
Read data for all business scenarios this app creates or ownsBusinessScenarioData.Read.OwnedBy
Read and write data for all business scenarios this app creates or ownsBusinessScenarioData.ReadWrite.OwnedBy
Read calendars in all mailboxesCalendars.Read
Read basic details of calendars in all mailboxesCalendars.ReadBasic.All
Read and write calendars in all mailboxesCalendars.ReadWrite
Read all emergency call eventsCallEvents-Emergency.Read.All
Read all call eventsCallEvents.Read.All
Read PSTN and direct routing call log dataCallRecord-PstnCalls.Read.All
Read all call recordsCallRecords.Read.All
Access media streams in a call as an appCalls.AccessMedia.All
Initiate outgoing 1 to 1 calls from the appCalls.Initiate.All
Initiate outgoing group calls from the appCalls.InitiateGroupCall.All
Join group calls and meetings as an appCalls.JoinGroupCall.All
Join group calls and meetings as a guestCalls.JoinGroupCallAsGuest.All
Read Change Management itemsChangeManagement.Read.All
Create channelsChannel.Create
Delete channelsChannel.Delete.All
Read the names and descriptions of all channelsChannel.ReadBasic.All
Read the members of all channelsChannelMember.Read.All
Add and remove members from all channelsChannelMember.ReadWrite.All
Read all channel messagesChannelMessage.Read.All
Flag channel messages for violating policyChannelMessage.UpdatePolicyViolation.All
Read the names, descriptions, and settings of all channelsChannelSettings.Read.All
Read and write the names, descriptions, and settings of all channelsChannelSettings.ReadWrite.All
Create chatsChat.Create
Delete and recover deleted chatsChat.ManageDeletion.All
Read all chat messagesChat.Read.All
Read all chat messages for chats where the associated Teams application is installed.Chat.Read.WhereInstalled
Read names and members of all chat threadsChat.ReadBasic.All
Read names and members of all chat threads where the associated Teams application is installed.Chat.ReadBasic.WhereInstalled
Read and write all chat messagesChat.ReadWrite.All
Read and write all chat messages for chats where the associated Teams application is installed.Chat.ReadWrite.WhereInstalled
Flag chat messages for violating policyChat.UpdatePolicyViolation.All
Read the members of all chatsChatMember.Read.All
Read the members of all chats where the associated Teams application is installed.ChatMember.Read.WhereInstalled
Add and remove members from all chatsChatMember.ReadWrite.All
Add and remove members from all chats where the associated Teams application is installed.ChatMember.ReadWrite.WhereInstalled
Read all chat messagesChatMessage.Read.All
Read all discovered cloud applications dataCloudApp-Discovery.Read.All
Read Cloud PCsCloudPC.Read.All
Read and write Cloud PCsCloudPC.ReadWrite.All
Read all Viva Engage communitiesCommunity.Read.All
Read and write all Viva Engage communitiesCommunity.ReadWrite.All
Read all consent requestsConsentRequest.Read.All
Read and write all consent requestsConsentRequest.ReadWrite.All
Read contacts in all mailboxesContacts.Read
Read and write contacts in all mailboxesContacts.ReadWrite
Read cross-tenant basic informationCrossTenantInformation.ReadBasic.All
Read all shared cross-tenant user profiles and export their dataCrossTenantUserProfileSharing.Read.All
Read all shared cross-tenant user profiles and export or delete their dataCrossTenantUserProfileSharing.ReadWrite.All
Read all custom authentication extensionsCustomAuthenticationExtension.Read.All
Read and write all custom authentication extensionsCustomAuthenticationExtension.ReadWrite.All
Receive custom authentication extension HTTP requestsCustomAuthenticationExtension.Receive.Payload
Read all custom detection rulesCustomDetection.Read.All
Read and write all custom detection rulesCustomDetection.ReadWrite.All
Read custom security attribute assignmentsCustomSecAttributeAssignment.Read.All
Read and write custom security attribute assignmentsCustomSecAttributeAssignment.ReadWrite.All
Read all custom security attribute audit logsCustomSecAttributeAuditLogs.Read.All
Read custom security attribute definitionsCustomSecAttributeDefinition.Read.All
Read and write custom security attribute definitionsCustomSecAttributeDefinition.ReadWrite.All
Read the provisioning configuration of all active custom security attributesCustomSecAttributeProvisioning.Read.All
Read and edit the provisioning configuration of all active custom security attributesCustomSecAttributeProvisioning.ReadWrite.All
Read all custom tags dataCustomTags.Read.All
Read and write custom tags dataCustomTags.ReadWrite.All
Read Delegated Admin relationships with customersDelegatedAdminRelationship.Read.All
Manage Delegated Admin relationships with customersDelegatedAdminRelationship.ReadWrite.All
Read all delegated permission grantsDelegatedPermissionGrant.Read.All
Manage all delegated permission grantsDelegatedPermissionGrant.ReadWrite.All
Read all devicesDevice.Read.All
Read and write devicesDevice.ReadWrite.All
Read device local credential passwordsDeviceLocalCredential.Read.All
Read device local credential propertiesDeviceLocalCredential.ReadBasic.All
Read Microsoft Intune appsDeviceManagementApps.Read.All
Read and write Microsoft Intune appsDeviceManagementApps.ReadWrite.All
Read Microsoft Cloud PKI objectsDeviceManagementCloudCA.Read.All
Read and write Microsoft Cloud PKI objectsDeviceManagementCloudCA.ReadWrite.All
Read Microsoft Intune device configuration and policiesDeviceManagementConfiguration.Read.All
Read and write Microsoft Intune device configuration and policiesDeviceManagementConfiguration.ReadWrite.All
Perform user-impacting remote actions on Microsoft Intune devicesDeviceManagementManagedDevices.PrivilegedOperations.All
Read Microsoft Intune devicesDeviceManagementManagedDevices.Read.All
Read and write Microsoft Intune devicesDeviceManagementManagedDevices.ReadWrite.All
Read Microsoft Intune RBAC settingsDeviceManagementRBAC.Read.All
Read and write Microsoft Intune RBAC settingsDeviceManagementRBAC.ReadWrite.All
Read Microsoft Intune ScriptsDeviceManagementScripts.Read.All
Read and write Microsoft Intune ScriptsDeviceManagementScripts.ReadWrite.All
Read Microsoft Intune configurationDeviceManagementServiceConfig.Read.All
Read and write Microsoft Intune configurationDeviceManagementServiceConfig.ReadWrite.All
Create device templateDeviceTemplate.Create
Read all device templatesDeviceTemplate.Read.All
Read and write all device templatesDeviceTemplate.ReadWrite.All
Read directory dataDirectory.Read.All
Read and write directory dataDirectory.ReadWrite.All
Read all Azure AD recommendationsDirectoryRecommendations.Read.All
Read and update all Azure AD recommendationsDirectoryRecommendations.ReadWrite.All
Read domainsDomain.Read.All
Read and write domainsDomain.ReadWrite.All
Read all eDiscovery objectseDiscovery.Read.All
Read and write all eDiscovery objectseDiscovery.ReadWrite.All
Read Education app settingsEduAdministration.Read.All
Manage education app settingsEduAdministration.ReadWrite.All
Read all class assignments with gradesEduAssignments.Read.All
Read all class assignments without gradesEduAssignments.ReadBasic.All
Create, read, update and delete all class assignments with gradesEduAssignments.ReadWrite.All
Create, read, update and delete all class assignments without gradesEduAssignments.ReadWriteBasic.All
Read all class modules and resourcesEduCurricula.Read.All
Read and write all class modules and resourcesEduCurricula.ReadWrite.All
Read all tenant reading assignments submissions dataEduReports-Reading.Read.All
Read all tenant reading assignments submissions dataEduReports-Reading.ReadAnonymous.All
Read all tenant reflect check-ins submissions dataEduReports-Reflect.Read.All
Read all tenant reflect check-ins submissions dataEduReports-Reflect.ReadAnonymous.All
Read the organization's rosterEduRoster.Read.All
Read a limited subset of the organization's rosterEduRoster.ReadBasic.All
Read and write the organization's rosterEduRoster.ReadWrite.All
Read all entitlement management resourcesEntitlementManagement.Read.All
Read and write all entitlement management resourcesEntitlementManagement.ReadWrite.All
Read all authentication event listenersEventListener.Read.All
Read and write all authentication event listenersEventListener.ReadWrite.All
Read all external connectionsExternalConnection.Read.All
Read and write all external connectionsExternalConnection.ReadWrite.All
Read and write external connectionsExternalConnection.ReadWrite.OwnedBy
Read all external itemsExternalItem.Read.All
Read and write items in external datasetsExternalItem.ReadWrite.All
Read and write external itemsExternalItem.ReadWrite.OwnedBy
Read all external user profilesExternalUserProfile.Read.All
Read and write all external user profilesExternalUserProfile.ReadWrite.All
Ingest SharePoint and OneDrive content to make it available in the search indexFileIngestion.Ingest
Manage onboarding for a Hybrid Cloud tenantFileIngestionHybridOnboarding.Manage
Read files in all site collectionsFiles.Read.All
Read and write files in all site collectionsFiles.ReadWrite.All
Have full access to the application's folder without a signed in user.Files.ReadWrite.AppFolder
Access selected Files without a signed in user.Files.SelectedOperations.Selected
Access selected file storage containersFileStorageContainer.Selected
Read all group conversationsGroup-Conversation.Read.All
Read and write all group conversationsGroup-Conversation.ReadWrite.All
Create groupsGroup.Create
Read all groupsGroup.Read.All
Read and write all groupsGroup.ReadWrite.All
Read all group membershipsGroupMember.Read.All
Read and write all group membershipsGroupMember.ReadWrite.All
Read all scenario health monitoring alertHealthMonitoringAlert.Read.All
Read and write all scenario monitoring alertsHealthMonitoringAlert.ReadWrite.All
Read all scenario health monitoring alert configurationsHealthMonitoringAlertConfig.Read.All
Read and write all scenario monitoring alertsHealthMonitoringAlertConfig.ReadWrite.All
Read identity providersIdentityProvider.Read.All
Read and write identity providersIdentityProvider.ReadWrite.All
Read all identity risk event informationIdentityRiskEvent.Read.All
Read and write all risk detection informationIdentityRiskEvent.ReadWrite.All
Read all identity risky service principal informationIdentityRiskyServicePrincipal.Read.All
Read and write all identity risky service principal informationIdentityRiskyServicePrincipal.ReadWrite.All
Read all identity risky user informationIdentityRiskyUser.Read.All
Read and write all risky user informationIdentityRiskyUser.ReadWrite.All
Read all identity user flowsIdentityUserFlow.Read.All
Read and write all identity user flowsIdentityUserFlow.ReadWrite.All
View data connector definitionsIndustryData-DataConnector.Read.All
Manage data connector definitionsIndustryData-DataConnector.ReadWrite.All
Upload files to a data connectorIndustryData-DataConnector.Upload
View inbound flow definitionsIndustryData-InboundFlow.Read.All
Manage inbound flow definitionsIndustryData-InboundFlow.ReadWrite.All
View outbound flow definitionsIndustryData-OutboundFlow.Read.All
Manage outbound flow definitionsIndustryData-OutboundFlow.ReadWrite.All
View reference definitionsIndustryData-ReferenceDefinition.Read.All
Manage reference definitionsIndustryData-ReferenceDefinition.ReadWrite.All
View current and previous runsIndustryData-Run.Read.All
View and start runsIndustryData-Run.Start
View source system definitionsIndustryData-SourceSystem.Read.All
Manage source system definitionsIndustryData-SourceSystem.ReadWrite.All
Read time period definitionsIndustryData-TimePeriod.Read.All
Manage time period definitionsIndustryData-TimePeriod.ReadWrite.All
View basic service and resource informationIndustryData.ReadBasic.All
Read all configurations for protecting organizational data applicable to usersInformationProtectionConfig.Read.All
Sign digests for dataInformationProtectionContent.Sign.All
Create protected contentInformationProtectionContent.Write.All
Read all published labels and label policies for an organization.InformationProtectionPolicy.Read.All
Read all user metrics insightsInsights-UserMetric.Read.All
Read all assignmentsLearningAssignedCourse.Read.All
Read and write all assignmentsLearningAssignedCourse.ReadWrite.All
Read all learning contentLearningContent.Read.All
Manage all learning contentLearningContent.ReadWrite.All
Read all self-initiated coursesLearningSelfInitiatedCourse.Read.All
Read and write all self-initiated coursesLearningSelfInitiatedCourse.ReadWrite.All
Manage all license assignmentsLicenseAssignment.ReadWrite.All
Read all lifecycle workflows resourcesLifecycleWorkflows.Read.All
Read and write all lifecycle workflows resourcesLifecycleWorkflows.ReadWrite.All
Access selected ListItems without a signed in user.ListItems.SelectedOperations.Selected
Access selected Lists without a signed in user.Lists.SelectedOperations.Selected
Read mail in all mailboxesMail.Read
Read basic mail in all mailboxesMail.ReadBasic
Read basic mail in all mailboxesMail.ReadBasic.All
Read and write mail in all mailboxesMail.ReadWrite
Send mail as any userMail.Send
Read all the users' mailbox foldersMailboxFolder.Read.All
Read and write all the users' mailbox foldersMailboxFolder.ReadWrite.All
Allows the app to perform backup and restore for all mailbox itemsMailboxItem.ImportExport.All
Read all the users' mailbox itemsMailboxItem.Read.All
Read all user mailbox settingsMailboxSettings.Read
Read and write all user mailbox settingsMailboxSettings.ReadWrite
Read all hidden membershipsMember.Read.Hidden
Read all multi-tenant organization details and tenantsMultiTenantOrganization.Read.All
Read multi-tenant organization basic details and active tenantsMultiTenantOrganization.ReadBasic.All
Read and write all multi-tenant organization details and tenantsMultiTenantOrganization.ReadWrite.All
Read all configurations used for mutual-TLS client authentication.MutualTlsOauthConfiguration.Read.All
Read and write all configurations used for mutual-TLS client authentication.MutualTlsOauthConfiguration.ReadWrite.All
Read all network access reportsNetworkAccess-Reports.Read.All
Read all network access informationNetworkAccess.Read.All
Read and write all network access informationNetworkAccess.ReadWrite.All
Read properties of all branches for network accessNetworkAccessBranch.Read.All
Read and write properties of all branches for network accessNetworkAccessBranch.ReadWrite.All
Read all security and routing policies for network accessNetworkAccessPolicy.Read.All
Read and write all security and routing policies for network accessNetworkAccessPolicy.ReadWrite.All
Read all OneNote notebooksNotes.Read.All
Read and write all OneNote notebooksNotes.ReadWrite.All
Read all AI Insights for online meetings.OnlineMeetingAiInsight.Read.All
Read all AI Insights for online meetings where the Teams application is installed.OnlineMeetingAiInsight.Read.Chat
Read online meeting artifactsOnlineMeetingArtifact.Read.All
Read all recordings of online meetings.OnlineMeetingRecording.Read.All
Read online meeting detailsOnlineMeetings.Read.All
Read and create online meetingsOnlineMeetings.ReadWrite.All
Read all transcripts of online meetings.OnlineMeetingTranscript.Read.All
Read all on-premises directory synchronization informationOnPremDirectorySynchronization.Read.All
Read and write all on-premises directory synchronization informationOnPremDirectorySynchronization.ReadWrite.All
Manage on-premises published resourcesOnPremisesPublishingProfiles.ReadWrite.All
Read organization informationOrganization.Read.All
Read and write organization informationOrganization.ReadWrite.All
Read organizational branding informationOrganizationalBranding.Read.All
Read and write organizational branding informationOrganizationalBranding.ReadWrite.All
Read organizational contactsOrgContact.Read.All
Read organization-wide apps and services settingsOrgSettings-AppsAndServices.Read.All
Read and write organization-wide apps and services settingsOrgSettings-AppsAndServices.ReadWrite.All
Read organization-wide Dynamics customer voice settingsOrgSettings-DynamicsVoice.Read.All
Read and write organization-wide Dynamics customer voice settingsOrgSettings-DynamicsVoice.ReadWrite.All
Read organization-wide Microsoft Forms settingsOrgSettings-Forms.Read.All
Read and write organization-wide Microsoft Forms settingsOrgSettings-Forms.ReadWrite.All
Read organization-wide Microsoft 365 apps installation settingsOrgSettings-Microsoft365Install.Read.All
Read and write organization-wide Microsoft 365 apps installation settingsOrgSettings-Microsoft365Install.ReadWrite.All
Read organization-wide Microsoft To Do settingsOrgSettings-Todo.Read.All
Read and write organization-wide Microsoft To Do settingsOrgSettings-Todo.ReadWrite.All
Read all billing data for your company's tenantPartnerBilling.Read.All
Read security alerts of customer with CSP relationshipPartnerSecurity.Read.All
Read security alerts and update status of security alerts of customer with CSP relationshipPartnerSecurity.ReadWrite.All
Read all pending external user profilesPendingExternalUserProfile.Read.All
Read and write all pending external user profilesPendingExternalUserProfile.ReadWrite.All
Read all users' relevant people listsPeople.Read.All
Read all tenant-wide people settingsPeopleSettings.Read.All
Read and write all tenant-wide people settingsPeopleSettings.ReadWrite.All
Read all company placesPlace.Read.All
Read all workplace devicesPlaceDevice.Read.All
Read and write all workplace devicesPlaceDevice.ReadWrite.All
Read and write telemetry for all workplace devices.PlaceDeviceTelemetry.ReadWrite.All
Read your organization's policiesPolicy.Read.All
Read your organization's conditional access policiesPolicy.Read.ConditionalAccess
Read your organization's device configuration policiesPolicy.Read.DeviceConfiguration
Read your organization’s identity protection policyPolicy.Read.IdentityProtection
Read consent and permission grant policiesPolicy.Read.PermissionGrant
Read and write your organization's directory access review default policyPolicy.ReadWrite.AccessReview
Read and write your organization's application configuration policiesPolicy.ReadWrite.ApplicationConfiguration
Read and write authentication flow policiesPolicy.ReadWrite.AuthenticationFlows
Read and write all authentication method policies Policy.ReadWrite.AuthenticationMethod
Read and write your organization's authorization policyPolicy.ReadWrite.Authorization
Read and write your organization's conditional access policiesPolicy.ReadWrite.ConditionalAccess
Read and write your organization's consent request policyPolicy.ReadWrite.ConsentRequest
Read and write your organization's cross tenant access policiesPolicy.ReadWrite.CrossTenantAccess
Read and write your organization's device configuration policiesPolicy.ReadWrite.DeviceConfiguration
Read and write your organization's external identities policyPolicy.ReadWrite.ExternalIdentities
Read and write feature rollout policiesPolicy.ReadWrite.FeatureRollout
Read and write your organization's federated token validation policyPolicy.ReadWrite.FedTokenValidation
Read and write your organization’s identity protection policyPolicy.ReadWrite.IdentityProtection
Manage consent and permission grant policiesPolicy.ReadWrite.PermissionGrant
Read and write your organization's security defaults policyPolicy.ReadWrite.SecurityDefaults
Read and write your organization's trust framework policiesPolicy.ReadWrite.TrustFramework
Read presence information for all usersPresence.Read.All
Read and write presence information for all usersPresence.ReadWrite.All
Read printersPrinter.Read.All
Read and update printersPrinter.ReadWrite.All
Perform advanced operations on print jobsPrintJob.Manage.All
Read print jobsPrintJob.Read.All
Read basic information for print jobsPrintJob.ReadBasic.All
Read and write print jobsPrintJob.ReadWrite.All
Read and write basic information for print jobsPrintJob.ReadWriteBasic.All
Read tenant-wide print settingsPrintSettings.Read.All
Read, write and update print task definitionsPrintTaskDefinition.ReadWrite.All
Read privileged access to Azure AD rolesPrivilegedAccess.Read.AzureAD
Read privileged access to Azure AD groupsPrivilegedAccess.Read.AzureADGroup
Read privileged access to Azure resourcesPrivilegedAccess.Read.AzureResources
Read and write privileged access to Azure AD rolesPrivilegedAccess.ReadWrite.AzureAD
Read and write privileged access to Azure AD groupsPrivilegedAccess.ReadWrite.AzureADGroup
Read and write privileged access to Azure resourcesPrivilegedAccess.ReadWrite.AzureResources
Read assignment schedules for access to Azure AD groupsPrivilegedAssignmentSchedule.Read.AzureADGroup
Read, create, and delete assignment schedules for access to Azure AD groupsPrivilegedAssignmentSchedule.ReadWrite.AzureADGroup
Delete assignment schedules for access to Azure AD groupsPrivilegedAssignmentSchedule.Remove.AzureADGroup
Read eligibility schedules for access to Azure AD groupsPrivilegedEligibilitySchedule.Read.AzureADGroup
Read, create, and delete eligibility schedules for access to Azure AD groupsPrivilegedEligibilitySchedule.ReadWrite.AzureADGroup
Delete eligibility schedules for access to Azure AD groupsPrivilegedEligibilitySchedule.Remove.AzureADGroup
Read profile photo of a user or groupProfilePhoto.Read.All
Read and write profile photo of a user or groupProfilePhoto.ReadWrite.All
Read all programsProgramControl.Read.All
Manage all programsProgramControl.ReadWrite.All
Read all certificate based authentication configurationsPublicKeyInfrastructure.Read.All
Read and write all certificate based authentication configurationsPublicKeyInfrastructure.ReadWrite.All
Read all Question and AnswersQnA.Read.All
Read Records Management configuration, labels and policiesRecordsManagement.Read.All
Read and write Records Management configuration, labels and policiesRecordsManagement.ReadWrite.All
Read all usage reportsReports.Read.All
Read all admin report settingsReportSettings.Read.All
Read and write all admin report settingsReportSettings.ReadWrite.All
Read resource specific permissions granted on a chatResourceSpecificPermissionGrant.ReadForChat.All
Read resource specific permissions granted on a teamResourceSpecificPermissionGrant.ReadForTeam.All
Read all resource specific permissions granted on user accountsResourceSpecificPermissionGrant.ReadForUser.All
Read all identity risk prevention providersRiskPreventionProviders.Read.All
Read and write all identity risk prevention providersRiskPreventionProviders.ReadWrite.All
Read all active role assignments and role schedules for your company's directoryRoleAssignmentSchedule.Read.Directory
Read, update, and delete all policies for privileged role assignments of your company's directoryRoleAssignmentSchedule.ReadWrite.Directory
Delete all active role assignments of your company's directoryRoleAssignmentSchedule.Remove.Directory
Read all eligible role assignments and role schedules for your company's directoryRoleEligibilitySchedule.Read.Directory
Read, update, and delete all eligible role assignments and schedules for your company's directoryRoleEligibilitySchedule.ReadWrite.Directory
Delete all eligible role assignments of your company's directoryRoleEligibilitySchedule.Remove.Directory
Read role management data for all RBAC providersRoleManagement.Read.All
Read Cloud PC RBAC settingsRoleManagement.Read.CloudPC
Read M365 Defender RBAC configurationRoleManagement.Read.Defender
Read all directory RBAC settingsRoleManagement.Read.Directory
Read Exchange Online RBAC configurationRoleManagement.Read.Exchange
Read and write all Cloud PC RBAC settingsRoleManagement.ReadWrite.CloudPC
Read M365 Defender RBAC configurationRoleManagement.ReadWrite.Defender
Read and write all directory RBAC settingsRoleManagement.ReadWrite.Directory
Read and write Exchange Online RBAC configurationRoleManagement.ReadWrite.Exchange
Read all alert data for your company's directoryRoleManagementAlert.Read.Directory
Read all alert data, configure alerts, and take actions on all alerts for your company's directoryRoleManagementAlert.ReadWrite.Directory
Read all policies in PIM for GroupsRoleManagementPolicy.Read.AzureADGroup
Read all policies for privileged role assignments of your company's directoryRoleManagementPolicy.Read.Directory
Read, update, and delete all policies in PIM for GroupsRoleManagementPolicy.ReadWrite.AzureADGroup
Read, update, and delete all policies for privileged role assignments of your company's directoryRoleManagementPolicy.ReadWrite.Directory
Trigger working time policies and read the working time statusSchedule-WorkingTime.ReadWrite.All
Read all schedule itemsSchedule.Read.All
Read and write all schedule itemsSchedule.ReadWrite.All
Read/Write schedule permissions for a roleSchedulePermissions.ReadWrite.All
Read your organization's search configurationSearchConfiguration.Read.All
Read and write your organization's search configurationSearchConfiguration.ReadWrite.All
Read your organization's security actionsSecurityActions.Read.All
Read and update your organization's security actionsSecurityActions.ReadWrite.All
Read all security alertsSecurityAlert.Read.All
Read and write to all security alertsSecurityAlert.ReadWrite.All
Read metadata and detection details for all emails in your organizationSecurityAnalyzedMessage.Read.All
Read metadata, detection details, and execute remediation actions on all emails in your organizationSecurityAnalyzedMessage.ReadWrite.All
Read your organization’s security eventsSecurityEvents.Read.All
Read and update your organization’s security eventsSecurityEvents.ReadWrite.All
Read all identity security health issuesSecurityIdentitiesHealth.Read.All
Read and write all identity security health issuesSecurityIdentitiesHealth.ReadWrite.All
Read all identity security sensorsSecurityIdentitiesSensors.Read.All
Read and write all identity security sensorsSecurityIdentitiesSensors.ReadWrite.All
Read all identity security available user actionsSecurityIdentitiesUserActions.Read.All
Read and perform all identity security available user actionsSecurityIdentitiesUserActions.ReadWrite.All
Read all security incidentsSecurityIncident.Read.All
Read and write to all security incidentsSecurityIncident.ReadWrite.All
Read all Exchange service activityServiceActivity-Exchange.Read.All
Read all Microsoft 365 Web service activityServiceActivity-Microsoft365Web.Read.All
Read all One Drive service activityServiceActivity-OneDrive.Read.All
Read all Teams service activityServiceActivity-Teams.Read.All
Read service healthServiceHealth.Read.All
Read service messagesServiceMessage.Read.All
Read service principal endpointsServicePrincipalEndpoint.Read.All
Read and update service principal endpointsServicePrincipalEndpoint.ReadWrite.All
Read SharePoint and OneDrive tenant settingsSharePointTenantSettings.Read.All
Read and change SharePoint and OneDrive tenant settingsSharePointTenantSettings.ReadWrite.All
Read all users' short notesShortNotes.Read.All
Read, create, edit, and delete all users' short notesShortNotes.ReadWrite.All
Have full control of all site collectionsSites.FullControl.All
Create, edit, and delete items and lists in all site collectionsSites.Manage.All
Read items in all site collectionsSites.Read.All
Read and write items in all site collectionsSites.ReadWrite.All
Access selected site collectionsSites.Selected
Read SPIFFE trust domains and child resourcesSpiffeTrustDomain.Read.All
Read and write SPIFFE trust domains and child resourcesSpiffeTrustDomain.ReadWrite.All
Read all subject rights requestsSubjectRightsRequest.Read.All
Read and write all subject rights requestsSubjectRightsRequest.ReadWrite.All
Read all Azure AD synchronization data.Synchronization.Read.All
Read and write all Azure AD synchronization data.Synchronization.ReadWrite.All
Upload user data to the identity synchronization serviceSynchronizationData-User.Upload
Upload user data to the identity sync service for apps that this application creates or ownsSynchronizationData-User.Upload.OwnedBy
Read all users’ tasks and tasklistTasks.Read.All
Read and write all users’ tasks and tasklistsTasks.ReadWrite.All
Create teamsTeam.Create
Get a list of all teamsTeam.ReadBasic.All
Read the members of all teamsTeamMember.Read.All
Add and remove members from all teamsTeamMember.ReadWrite.All
Add and remove members with non-owner role for all teamsTeamMember.ReadWriteNonOwnerRole.All
Read all users' teamwork activity feedTeamsActivity.Read.All
Send a teamwork activity to any userTeamsActivity.Send
Manage installation and permission grants of selected Teams apps in all chatsTeamsAppInstallation.ManageSelectedForChat.All
Manage installation and permission grants of selected Teams apps in all teamsTeamsAppInstallation.ManageSelectedForTeam.All
Manage installation and permission grants of selected Teams apps for all user accountsTeamsAppInstallation.ManageSelectedForUser.All
Read installed Teams apps for all installation scopesTeamsAppInstallation.Read.All
Read installed Teams apps for all chatsTeamsAppInstallation.ReadForChat.All
Read installed Teams apps for all teamsTeamsAppInstallation.ReadForTeam.All
Read installed Teams apps for all usersTeamsAppInstallation.ReadForUser.All
Read selected installed Teams apps in all chatsTeamsAppInstallation.ReadSelectedForChat.All
Read selected installed Teams apps in all teamsTeamsAppInstallation.ReadSelectedForTeam.All
Read selected installed Teams apps for all usersTeamsAppInstallation.ReadSelectedForUser.All
Manage installation and permission grants of Teams apps for all chatsTeamsAppInstallation.ReadWriteAndConsentForChat.All
Manage installation and permission grants of Teams apps for all teamsTeamsAppInstallation.ReadWriteAndConsentForTeam.All
Manage installation and permission grants of Teams apps in a user accountTeamsAppInstallation.ReadWriteAndConsentForUser.All
Allow the Teams app to manage itself and its permission grants for all chatsTeamsAppInstallation.ReadWriteAndConsentSelfForChat.All
Allow the Teams app to manage itself and its permission grants for all teamsTeamsAppInstallation.ReadWriteAndConsentSelfForTeam.All
Allow the Teams app to manage itself and its permission grants in all user accountsTeamsAppInstallation.ReadWriteAndConsentSelfForUser.All
Manage Teams apps for all chatsTeamsAppInstallation.ReadWriteForChat.All
Manage Teams apps for all teamsTeamsAppInstallation.ReadWriteForTeam.All
Manage Teams apps for all usersTeamsAppInstallation.ReadWriteForUser.All
Manage selected installed Teams apps in all chatsTeamsAppInstallation.ReadWriteSelectedForChat.All
Manage selected installed Teams apps in all teamsTeamsAppInstallation.ReadWriteSelectedForTeam.All
Manage selected Teams apps installed for all usersTeamsAppInstallation.ReadWriteSelectedForUser.All
Allow the Teams app to manage itself for all chatsTeamsAppInstallation.ReadWriteSelfForChat.All
Allow the Teams app to manage itself for all teamsTeamsAppInstallation.ReadWriteSelfForTeam.All
Allow the app to manage itself for all usersTeamsAppInstallation.ReadWriteSelfForUser.All
Read all teams' settingsTeamSettings.Read.All
Read and change all teams' settingsTeamSettings.ReadWrite.All
Read and Write Teams policy user assignment and unassigment for all policy types.TeamsPolicyUserAssign.ReadWrite.All
Read Teams resource accountsTeamsResourceAccount.Read.All
Create tabs in Microsoft Teams.TeamsTab.Create
Read tabs in Microsoft Teams.TeamsTab.Read.All
Read and write tabs in Microsoft Teams.TeamsTab.ReadWrite.All
Allow the Teams app to manage all tabs for all chatsTeamsTab.ReadWriteForChat.All
Allow the Teams app to manage all tabs for all teamsTeamsTab.ReadWriteForTeam.All
Allow the app to manage all tabs for all usersTeamsTab.ReadWriteForUser.All
Allow the Teams app to manage only its own tabs for all chatsTeamsTab.ReadWriteSelfForChat.All
Allow the Teams app to manage only its own tabs for all teamsTeamsTab.ReadWriteSelfForTeam.All
Allow the Teams app to manage only its own tabs for all usersTeamsTab.ReadWriteSelfForUser.All
Read Teams user configurationsTeamsUserConfiguration.Read.All
Read all available Teams TemplatesTeamTemplates.Read.All
Create chat and channel messages with anyone's identity and with any timestampTeamwork.Migrate.All
Read organizational teamwork settingsTeamwork.Read.All
Read Teams app settingsTeamworkAppSettings.Read.All
Read and write Teams app settingsTeamworkAppSettings.ReadWrite.All
Read Teams devicesTeamworkDevice.Read.All
Read and write Teams devicesTeamworkDevice.ReadWrite.All
Read tags in TeamsTeamworkTag.Read.All
Read and write tags in TeamsTeamworkTag.ReadWrite.All
Read all term store dataTermStore.Read.All
Read and write all term store dataTermStore.ReadWrite.All
Read threat assessment requestsThreatAssessment.Read.All
Run hunting queriesThreatHunting.Read.All
Read all threat indicatorsThreatIndicators.Read.All
Manage threat indicators this app creates or ownsThreatIndicators.ReadWrite.OwnedBy
Read all Threat Intelligence InformationThreatIntelligence.Read.All
Read all of the organization's threat submissionsThreatSubmission.Read.All
Read and write all of the organization's threat submissionsThreatSubmission.ReadWrite.All
Read and write all of the organization's threat submission policiesThreatSubmissionPolicy.ReadWrite.All
Read trust framework key setsTrustFrameworkKeySet.Read.All
Read and write trust framework key setsTrustFrameworkKeySet.ReadWrite.All
Convert an external user to internal member userUser-ConvertToInternal.ReadWrite.All
Read all users' lifecycle informationUser-LifeCycleInfo.Read.All
Read and write all users' lifecycle informationUser-LifeCycleInfo.ReadWrite.All
Read and write all secondary mail addresses for usersUser-Mail.ReadWrite.All
Read and write all password profiles and reset user passwordsUser-PasswordProfile.ReadWrite.All
Read and write all user mobile phone and business phonesUser-Phone.ReadWrite.All
Delete and restore all usersUser.DeleteRestore.All
Enable and disable user accountsUser.EnableDisableAccount.All
Export user's dataUser.Export.All
Invite guest users to the organizationUser.Invite.All
Manage all users' identitiesUser.ManageIdentities.All
Read all users' full profilesUser.Read.All
Read all users' basic profilesUser.ReadBasic.All
Read and write all users' full profilesUser.ReadWrite.All
Revoke all sign in sessions for a userUser.RevokeSessions.All
Read all users' authentication methodsUserAuthenticationMethod.Read.All
Read and write all users' authentication methodsUserAuthenticationMethod.ReadWrite.All
Read all users' passkey authentication methodsUserAuthMethod-Passkey.Read.All
Read and write all users' passkey authentication methodsUserAuthMethod-Passkey.ReadWrite.All
Deliver and manage all user's notificationsUserNotification.ReadWrite.CreatedByApp
Read all user shift preferencesUserShiftPreferences.Read.All
Read and write all user shift preferencesUserShiftPreferences.ReadWrite.All
Read all user teamwork settingsUserTeamwork.Read.All
Read all virtual appointments for users, as authorized by online meetings application access policyVirtualAppointment.Read.All
Read-write all virtual appointments for users, as authorized by online meetings app access policyVirtualAppointment.ReadWrite.All
Send notification regarding virtual appointments as any userVirtualAppointmentNotification.Send
Read all users' virtual eventsVirtualEvent.Read.All
Read and write anonymous users' virtual event registrationsVirtualEventRegistration-Anon.ReadWrite.All
Read and write all Windows update deployment settingsWindowsUpdates.ReadWrite.All
Read and write workforce integrationsWorkforceIntegration.ReadWrite.All

Add Managed Identity permission

Now that we have defined our permission, we just need to apply it to the Managed Identity via PowerShell. To do this, we use the following commands:

$tenantId = "xxxx-xxxx-xxxx-xxxx-xxxxxxx" # Replace with your tenant ID - https://entra.microsoft.com

$graphApiAppId = "00000003-0000-0000-c000-000000000000" # Well known ID

$msiName = "function app name" # Name of your managed identity e.g. name of Function or Logic App

$graphPermissions = @("Mail.Send", "User.Read.All") # Add or remove permissions
 

Connect-AzureAD -TenantId $tenantId

$msi = Get-AzureADServicePrincipal -Filter "displayName eq '$msiName'" # Can take a few seconds, add a sleep if necessary

$graphApiAppRegistration = Get-AzureADServicePrincipal -Filter "appId eq '$graphApiAppId'"

$appRoles = $graphApiAppRegistration.AppRoles | Where-Object { $graphPermissions -contains $_.Value -and $_.AllowedMemberTypes -contains "Application" }

foreach ($appRole in $appRoles) {

      New-AzureAdServiceAppRoleAssignment -ObjectId $msi.ObjectId -PrincipalId $msi.ObjectId -ResourceId $graphApiAppRegistration.ObjectId -Id $appRole.Id

        }
This completes the permission changes. If you use an Azure Function and test it immediately to see if it works, you may still receive error messages such as “access denied” or similar. From time to time, Azure Function may not immediately recognize this or may still have cached information. Sometimes it takes several function restarts and stop/run commands and a few minutes of time.