Windows 365 and Azure Virtual Desktop Gateway IP Address Lookup Script
Managing connectivity for Windows 365 and Azure Virtual Desktop (AVD) is critical to ensuring seamless user experiences. VPN solutions often require up-to-date Gateway IPs or CIDR subnets to avoid Cloud PC performance degradation and connectivity issues.
The Windows 365 and AVD Gateway IP Address Lookup Script simplifies this process. It retrieves and outputs the Gateway IPs or CIDR subnets associated with Windows 365 and AVD in CSV format, which can be imported into VPN solutions.
This script has been updated to:
- Support GCCH (Government Community Cloud High) customers.
- Provide Gateway details in CIDR notation or IP Address format.
- Simplify the update process compared to earlier versions.
How It Works
Default Behavior
- Downloads a JSON file containing AVD Gateway information from the web.
- On the first run, the script saves the Gateway data into a CSV file named W365-Gateways.CSV.
- On subsequent runs, it compares the downloaded data with the existing CSV.
- If no differences are found, the script exits.
- If differences are found, the CSV file is updated with the latest Gateway IPs.
Azure Integration (Optional)
- Retrieves Gateway data directly from Azure when the web source is unavailable.
- Installs and imports required PowerShell modules (az.network and az.accounts) if not already present.
- Authenticates using Azure credentials.
- Updates outdated modules if the $CheckUpdates variable is set to $True.
Parameter Options
- -IP
Converts CIDR subnets to individual IP addresses. Use this if your VPN solution does not support CIDR subnets. - -GOV
Retrieves Gateway details for GCCH tenants. - -Azure
Fetches Gateway data directly from Azure. Not compatible with the -GOV parameter.
Usage
Setup
- Download and save the script in a designated folder.
- Run the script as Administrator from within the folder. Avoid using the PowerShell ISE console.
Examples
- Retrieve CIDR subnets (default behavior):
.\GatewayLookupScript.ps1
- Retrieve IP addresses instead of CIDR subnets:
.\GatewayLookupScript.ps1 -IP
- Fetch Gateway data for GCCH tenants:
.\GatewayLookupScript.ps1 -GOV
- Use Azure as the data source:
.\GatewayLookupScript.ps1 -Azure
Benefits
- Efficiency: Automatically detects and updates Gateway changes.
- Flexibility: Supports multiple parameters for custom use cases.
- GCCH Compatibility: Ensures support for government customers.
- Ease of Use: Simplifies data retrieval with minimal manual intervention.
Ensure your VPN configurations remain up to date with this powerful script, keeping your Windows 365 and AVD environments optimized and resilient against connectivity disruptions.