Can New-PartnerCustomerApplicationConsent grant application scope permissions for users/{id|userPrincipalName}/mailboxSettings/UserPurpose

Robert Cook 20 Reputation points
2023-09-08T13:13:07.15+00:00

Hi,

I am using the following to grant consent on behalf of for multiple customers but it sets the permissions type as delegated in the application. I need to grant application permissions, is this possible or is there another method I can use for multiple customers?

This is so I can query https://graph.microsoft.com/v1.0/users/{id|userPrincipalName}/mailboxSettings/userPurpose which from what I can tell needs application scope (only /me/mailboxSettings/userPurpose will work with delegated scope).

$PartnerCenter = Connect-PartnerCenter -AccessToken $PartnerAccessToken.AccessToken

$MSGraphgrant = New-Object -TypeName 				Microsoft.Store.PartnerCenter.Models.ApplicationConsents.ApplicationGrant
$MSgraphgrant.EnterpriseApplicationId = "00000003-0000-0000-c000-000000000000"
$MSGraphgrant.Scope = "MailboxSettings.Read"
$ExOgra


New-PartnerCustomerApplicationConsent -ApplicationGrants @($MSGraphgrant) -CustomerId $CustomerTenantId -ApplicationId $AppId -DisplayName $AppDisplayName

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,003 questions
Microsoft Partner Center API
Microsoft Partner Center API
Microsoft Partner Center: A Microsoft website for partners that provides access to product support, a partner community, and other partner services.API: A software intermediary that allows two applications to interact with each other.
337 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.