# Limit access to mailboxes

<figure><img src="https://627748108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0shDrJltbdGiCRz6ip4Z%2Fuploads%2F0U1G9m57W0d8fQjxdhHJ%2Flogo_microsoft365.webp?alt=media&#x26;token=efd6e5ec-67ec-4bb7-89ec-19183a1cc0ed" alt=""><figcaption></figcaption></figure>

To enhance security and control over UMA's access to Microsoft 365, we allow organisations to limit access to specific users and resources.

This setup is optional, and UMA will function as expected without changes if the existing authorisation process has been applied.&#x20;

We only access data configured by you via our admin portal, including users, room calendars and security groups.

### **Create a mail enabled security group**

Login to Microsoft 365 and create a mail enabled security group.

### **Add resources and mailboxes**

Add all users and resources intended for use in UMA.

### **Connect with PowerShell**

Launch PowerShell and connect using modern authentication:

```powershell
Connect-ExchangeOnline -UserPrincipalName {Microsoft 365 admin email address}
```

### **Apply application access policy**

Apply the application access policy to the UMA Vision enterprise application using the provided script:

```powershell
New-ApplicationAccessPolicy -AccessRight RestrictAccess -AppId "bea520a4-6256-441d-90af-37598ba710fd" -PolicyScopeGroupId "mail_enabled_security_email -Description "Restrict UMA to members of Mail Enabled Security Group (mail_enabled_security_name)."
```

Parameters:

* <mark style="color:blue;">AppId:</mark> UMA Vision enterprise application ID.
* <mark style="color:blue;">mailenabledsecurityemail:</mark> Email address set up in Step 1.
* <mark style="color:blue;">Description:</mark> A description of the policy.

### **Test the policy**

Test the newly created application access policy:

```powershell
Test-ApplicationAccessPolicy -Identity {EmailAddressInGroup} -AppId bea520a4-6256-441d-90af-37598ba710fd
```

An AccessCheckResult of "Granted" should be displayed.

```powershell
Test-ApplicationAccessPolicy -Identity {EmailAddressNotInGroup} -AppId bea520a4-6256-441d-90af-37598ba710fd
```

An AccessCheckResult of "Denied" should be displayed.

{% hint style="info" %}
Changes to application access policies may take over 1 hour to take effect with Microsoft Graph REST API calls. Even if Test-ApplicationAccessPolicy shows positive results.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.meetuma.ai/uma-knowledgebase/integrations/calendar/microsoft-365/limit-access-to-mailboxes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
