public:providing_limited_mailbox_access_to_an_entra_application

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
public:providing_limited_mailbox_access_to_an_entra_application [2026/11/05 13:21] – created thomaspublic:providing_limited_mailbox_access_to_an_entra_application [2026/11/05 13:47] (current) – thomas
Line 27: Line 27:
 </code> </code>
  
 +You can then validate if this works as intended by trying to access Graph API as your application. As an example:
 +
 +<code>
 +# I first set a few parameters needed to connect. Set $SecuredPassword to the app registration secret token.
 +$ApplicationId = "FC5775A1-0970-4718-8011-4847FEF89666"
 +$SecuredPassword = "<set your secret here>"
 +$tenantID = "A94B9837-0093-4CCF-AE2A-0A0F4EDC9593"
 +
 +# Convert the secret to a secure string.
 +$SecuredPasswordPassword = ConvertTo-SecureString -String $SecuredPassword -AsPlainText -Force
 +
 +# Convert all parameters in a PSCredential object.
 +$ClientSecretCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ApplicationId, $SecuredPasswordPassword
 +
 +# Connect to Microsoft Graph using this credential.
 +Connect-MgGraph -TenantId $tenantID -ClientSecretCredential $ClientSecretCredential
 +
 +# Attempt to list mailboxes from a mailbox we don't have access to. This should fail.
 +Get-MgUserMessage -UserId "inaccessible@domain.com" -Property "sender,subject"
 +
 +# Attempt to list mailboxes from a mailbox we do have access to. This should succeed.
 +Get-MgUserMessage -UserId "accessible@domain.com" -Property "sender,subject"
 +</code>
 +
 +{{tag> entra exchange}}
public/providing_limited_mailbox_access_to_an_entra_application.1793884882.txt.gz · Last modified: by thomas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki