-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-MgUserMailboxSetting Access Denied with Delegated Scopes #2966
Comments
I can confirm the exact same issue on my side. |
Yep, this seems to be a long running issue since MailSettings was added to Microsoft Graph which is disappointing. I'd love to spend the time transitioning to Graph but until these issues are fixed, better yet, even acknowledged seriously, I don't see a point. Creating an application within Entra for this specific thing is not a solution as delegation for the same tasks has worked fine in past APIs from Microsoft, nor is it a solution at a enterprise level for MSPs supporting many organizations. |
@ross-r apologies for the late reply. The service is giving a false response indicating that the required scopes have not been provided yet they have been provided. With such a scenario, we may not be best placed to give an answer/solution. I therefore advise that you kindly raise an issue here https://developer.microsoft.com/en-us/graph/support so that the API owner can respond to it. |
Confirmed that it's still the case. |
Created a case |
Describe the bug
I'm trying to use the powershell cmdlet Get-MgUserMailboxSetting and Update-MgUserMailboxSetting to automate work flow in my organization, however, I'm receiving access denied errors despite granting the correct permissions and consenting on behalf of my organization.
I've attempted to use Graph Explorer and unfortunately the same issue occurs there too.
Upon checking the permission details for Get-MgUserMailboxSetting, I'm led to believe this is unintended behavior:
The permissions descriptions for MailboxSettings.Read and MailboxSettings.ReadWrite explicitly state access to all users, however, it's only working on the user which had authenticated the application to begin with.
Reading around, I've came across multiple others experiencing this issue and other GitHub issues within this repo. The general consensus is that you need to register an application and authenticate with application permissions as opposed to delegated permissions, but again, the permission descriptions imply otherwise.
https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/grant-admin-consent?pivots=portal
https://stackoverflow.com/questions/54767695/error-access-denied-on-mailboxsettings-for-users
MartinM85/graph-mailbox-user-purpose#1
#2120
Here's an example of the powershell code I am running:
The sign in / authentication process:
I am authenticating with a Global Administrator account and attempting to access the mailbox settings of a regular licensed user.
Error:
As I mentioned earlier, I've done the exact same process using Graph Explorer, even consenting to the application on behalf of my organization within Entra
Expected behavior
I should, according to the permission descriptions for MailboxSettings.ReadWrite, be able to read and write mailbox settings for all users within an organization with delegated scopes.
How to reproduce
Execute:
Authenticate with a Global Administrator account and select "Consent on behalf of your organization"
SDK Version
2.23.0
Latest version known to work for scenario above?
Unknown, appears to be a long term issue with many reports and no official solution besides application permissions which again, the permission description implies is not needed
Known Workarounds
Unconfirmed, however, other users have reported this working with application permissions as opposed to delegated scope permissions.
Debug output
Click to expand log
Configuration
PSVersion 5.1.22621.963
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.963
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Other information
No response
The text was updated successfully, but these errors were encountered: