> ## 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 <a href={"/docs/enterprise/" +
"10.1" + "/reference/general/iam-role#iam-policies-aws"}>IAM policies
(AWS)</a> 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).

   <img src="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" alt="image::controller/ip-whitelist-aws-1.png" width="3006" height="562" data-path="images/guides/platform-administration/ip-whitelist-aws-1.png" />

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

   <img src="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" alt="image::controller/ip-whitelist-aws-2.png" width="2430" height="1280" data-path="images/guides/platform-administration/ip-whitelist-aws-2.png" />

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).

   <img src="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" alt="image::controller/ip-whitelist-aws-3.png" width="2844" height="1652" data-path="images/guides/platform-administration/ip-whitelist-aws-3.png" />

7. Click *Create policy*.

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

   <img src="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" alt="image::controller/ip-whitelist-aws-4.png" width="2998" height="816" data-path="images/guides/platform-administration/ip-whitelist-aws-4.png" />

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

   <img src="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" alt="image::controller/ip-whitelist-aws-5.png" width="2998" height="1346" data-path="images/guides/platform-administration/ip-whitelist-aws-5.png" />

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

    <img src="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" alt="image::controller/ip-whitelist-aws-6.png" width="2998" height="930" data-path="images/guides/platform-administration/ip-whitelist-aws-6.png" />

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

    <img src="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" alt="image::controller/ip-whitelist-aws-7.png" width="2998" height="1198" data-path="images/guides/platform-administration/ip-whitelist-aws-7.png" />

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.
</Note>

### Whitelisting in Azure

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

* have the service principal set up as described in <a href={"/docs/enterprise/" + "10.1" +
  "/guides/platform-administration/account-azure"}>Azure Account Credential
  Setup</a>. 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.

   <img src="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" alt="image::controller/ip-whitelist-azure-1.png" width="2998" height="870" data-path="images/guides/platform-administration/ip-whitelist-azure-1.png" />

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

   <img src="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" alt="image::controller/ip-whitelist-azure-2.png" width="2998" height="560" data-path="images/guides/platform-administration/ip-whitelist-azure-2.png" />

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

   <img src="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" alt="image::controller/ip-whitelist-azure-3.png" width="1857" height="2153" data-path="images/guides/platform-administration/ip-whitelist-azure-3.png" />

4. In the resulting dialog, do the following:

   <img src="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" alt="image::controller/ip-whitelist-azure-4.png" width="1654" height="2418" data-path="images/guides/platform-administration/ip-whitelist-azure-4.png" />

   * 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.

   <img src="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" alt="image::controller/ip-whitelist-azure-5.png" width="2988" height="826" data-path="images/guides/platform-administration/ip-whitelist-azure-5.png" />

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.

   <img src="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" alt="image::controller/ip-whitelist-azure-6.png" width="2411" height="1658" data-path="images/guides/platform-administration/ip-whitelist-azure-6.png" />

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.

   <img src="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" alt="image::controller/ip-whitelist-azure-7.png" width="3004" height="1568" data-path="images/guides/platform-administration/ip-whitelist-azure-7.png" />

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

   <img src="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" alt="image::controller/ip-whitelist-azure-8.png" width="672" height="1614" data-path="images/guides/platform-administration/ip-whitelist-azure-8.png" />

#### 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.

<img src="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" alt="image::controller/ip-whitelist-azure-9.png" width="2444" height="1124" data-path="images/guides/platform-administration/ip-whitelist-azure-9.png" />
