> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aviatrix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IP Whitelist AWS Azure

> This document describes how to configure IAM policies (AWS) and Conditional Access (Azure) to prevent a malfunctioning Controller mistakenly restored from a backup assuming control of onboarded CSP accounts.

## IP-based Whitelisting of Aviatrix Controller in AWS and Azure

This document describes how to configure [IAM policies
(AWS)](https://docs.aviatrix.com/docs/enterprise/9.0/reference/general/iam-role.md#iam-policies-aws) and
[Conditional Access (Azure)](https://learn.microsoft.com/en-us/azure/active-directory/conditional-access/overview)
to prevent a malfunctioning Controller mistakenly restored from a backup
assuming control of onboarded CSP accounts.

### Whitelisting in AWS

In your AWS Console, do the following to whitelist the Controller Elastic IP:

1. Navigate to Access Management > Policies under Identity and Access Management
   (IAM).

   ![image::controller/ip-whitelist-aws-1.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-aws-1.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=7015c346a563cc0666db6a5f73e4a814)

2. Click *Create policy* and switch to the JSON editor.

   ![image::controller/ip-whitelist-aws-2.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-aws-2.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=f601455f5dabdb2b0d3932db9320ed17)

3. Paste the following code into the JSON policy editor (replace the placeholder
   A.B.C.D/32 address with the Elastic IP of your Aviatrix Controller — for
   example, 34.216.134.10):

   ```json theme={null}
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Action": "*",
         "Resource": "*",
         "Effect": "Deny",
         "Condition": {
           "NotIpAddress": {
             "aws:SourceIp": ["A.B.C.D/32"]
           }
         }
       }
     ]
   }
   ```

4. Click *Next: Tags*.

5. Click *Next: Review*.

6. On the Create policy page, name the policy (for example,
   aviatrix-controller-whitelist-policy) and give it a description (optional).

   ![image::controller/ip-whitelist-aws-3.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-aws-3.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=a1b3cccaf63c7c9426ce1fcf5da476a6)

7. Click *Create policy*.

8. Switch to the Access management > Roles view and click the aviatrix-role-app.

   ![image::controller/ip-whitelist-aws-4.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-aws-4.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=31f1b565454b7d12e0baa1ffd37d0c6d)

9. Select *Attach policies* from the Add permissions drop down menu.

   ![image::controller/ip-whitelist-aws-5.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-aws-5.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=b59d2bd8d1adc26a8bbf98041faca2f8)

10. On the Add permissions page select the whitelist policy you just created and
    click *Attach policies*.

    ![image::controller/ip-whitelist-aws-6.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-aws-6.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=4f84c919d86663d458cdf69e4eae6beb)

11. You should now see two policies attached to the aviatrix-role-app:

    ![image::controller/ip-whitelist-aws-7.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-aws-7.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=7207f67fa086eb0246986d24b883a658)

Your AWS account is now protected from unauthorized IP access and rogue
Controllers.

#### Updating the Whitelist Policy

You should update the whitelist policy when you:

* rebuild the Controller with a different Elastic IP
* Invoke the Controller IP migration process

You can append the Elastic IP of the new Controller to the existing policy as
shown in the following code snippet (replacing the placeholder IP addresses):

```json theme={null}
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": "*",
            "Resource": "*",
            "Effect": "Deny",
            "Condition": {
                "NotIpAddress": {
                    "aws:SourceIp": [
                        "A.B.C.D/32", <-- Old Controller EIP, note the trailing comma
                        "W.X.Y.Z/32"  <-- New Controller EIP
                    ]
                }
            }
        }
    ]
}
```

Delete the comments before saving the policy.

> [!NOTE]
>
> Remove the old Controller Elastic IP from the policy after successful
> migration or Controller rebuild.

### Whitelisting in Azure

Before configuring the IP-based Controller whitelisting in Azure you must:

* have the service principal set up as described in [Azure Account Credential
  Setup](https://docs.aviatrix.com/docs/enterprise/9.0/guides/platform-administration/account-azure.md). The service principal may already exist if the Azure account was
  previously onboarded in the Aviatrix Controller. If the service principal
  already exists, you can determine its name by navigating to Microsoft Entra
  ID > Manage > App Registrations in the Azure portal.

* an
  [available Microsoft Entra ID Premium P1 license](https://azure.microsoft.com/en-us/pricing/details/active-directory/).
  Do the following to check if you already have this license:
  1. Go to Microsoft Entra ID > Manage > Licenses.
  2. On the Licenses page, go to Manage > All products.

To configure whitelisting in Azure:

1. Navigate to Microsoft Entra ID > Conditional Access > Manage > Named
   Locations in the Azure portal and create a new IP ranges location with the
   current public IP address of the Controller.

   ![image::controller/ip-whitelist-azure-1.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-azure-1.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=ed0dc951bfa8e7d0ea42a45f9ac5518a)

2. Navigate to Microsoft Entra ID Conditional Access > Policies in the Azure
   portal and create a new policy.

   ![image::controller/ip-whitelist-azure-2.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-azure-2.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=f3bb6176b088ba28cb8bb094afa7477c)

3. Name the policy and click *Specific service principals included*.

   ![image::controller/ip-whitelist-azure-3.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-azure-3.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=922db7640bbd1f1aa7d1ca7c24b02488)

4. In the resulting dialog, do the following:

   ![image::controller/ip-whitelist-azure-4.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-azure-4.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=794008322754729be398c258dc7bec37)

   * Select *Workload identities* from the What does this policy apply to list
   * Select the Include tab and select the *Select service principals* radio
     button
   * Click the *None* hyperlink

5. In the resulting dialog, select the principal you created/identified at the
   beginning of this procedure.

   ![image::controller/ip-whitelist-azure-5.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-azure-5.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=c798507646b30f570c1e86349431e296)

6. In the Conditional Access Policy configuration screen, click *All cloud apps*
   under Cloud apps or actions and then select the *All cloud apps* radio
   button.

   ![image::controller/ip-whitelist-azure-6.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-azure-6.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=c42a65ef6a881893f4e2b8122f282052)

7. After the condition is created, click the hyperlink in the Conditions section
   and create a location-based exclusion by selecting the named location created
   in step 1.

   ![image::controller/ip-whitelist-azure-7.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-azure-7.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=3919dc6717efc7131cf076eb9ec0a489)

8. To finalize the configuration, set the Access controls to *Block Access* and
   set Enable policy to *On*.

   ![image::controller/ip-whitelist-azure-8.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-azure-8.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=8daaa4ec96ac590fcbbb691f44ea93a5)

#### Verifying Conditional Access Policy

To confirm that the Conditional Access policy has been applied successfully, you
can view the logs in Microsoft Entra ID Conditional Access > Monitoring >
Sign-in logs.

![image::controller/ip-whitelist-azure-9.png](https://mintcdn.com/aviatrix-14b37c43/k65bKcXF8onWe87v/images/guides/platform-administration/ip-whitelist-azure-9.png?fit=max\&auto=format\&n=k65bKcXF8onWe87v\&q=85\&s=d718136bd68bbf1bc12c28f98badf13e)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.