public:providing_limited_mailbox_access_to_an_entra_application
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| public:providing_limited_mailbox_access_to_an_entra_application [2026/11/05 13:21] – created thomas | public:providing_limited_mailbox_access_to_an_entra_application [2026/11/05 13:47] (current) – thomas | ||
|---|---|---|---|
| Line 27: | Line 27: | ||
| </ | </ | ||
| + | You can then validate if this works as intended by trying to access Graph API as your application. As an example: | ||
| + | |||
| + | < | ||
| + | # I first set a few parameters needed to connect. Set $SecuredPassword to the app registration secret token. | ||
| + | $ApplicationId = " | ||
| + | $SecuredPassword = "< | ||
| + | $tenantID = " | ||
| + | |||
| + | # 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, | ||
| + | |||
| + | # 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 " | ||
| + | |||
| + | # Attempt to list mailboxes from a mailbox we do have access to. This should succeed. | ||
| + | Get-MgUserMessage -UserId " | ||
| + | </ | ||
| + | |||
| + | {{tag> entra exchange}} | ||
public/providing_limited_mailbox_access_to_an_entra_application.1793884882.txt.gz · Last modified: by thomas
