About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
windows_first
⚠️
missing_linux_example
⚠️
powershell_heavy
⚠️
windows_tools
Summary:
The documentation is heavily biased toward Windows environments. All configuration steps, examples, and command-line instructions are provided exclusively for Windows Server, using Windows-specific tools (PowerShell, netsh, editing machine.config, etc.). There are no examples or guidance for configuring Azure File Sync proxy/firewall settings on Linux or non-Windows platforms, nor is there any mention of Linux support or alternatives.
Recommendations:
- Explicitly state platform support: If Azure File Sync is only supported on Windows Server, clarify this at the beginning of the documentation. If Linux support is planned or available, provide equivalent instructions.
- Add Linux examples: For sections on proxy and firewall configuration, include Linux equivalents (e.g., using curl, iptables, firewalld, or editing environment variables for .NET Core apps on Linux).
- Provide cross-platform PowerShell/CLI guidance: Where PowerShell is used, mention if and how these cmdlets can be used on PowerShell Core on Linux, or provide Azure CLI alternatives.
- Reference Linux documentation: Link to relevant Microsoft or community documentation for configuring proxies and firewalls on Linux systems.
- Avoid hardcoding Windows paths: When referencing files or modules, note the Linux equivalents or clarify if they are Windows-only.
- Clarify tool availability: For tools like netsh or ServerRegistration.exe, state their platform limitations and suggest Linux alternatives if possible.
Create pull request
Flagged Code Snippets
Import-Module "C:\Program Files\Azure\StorageSyncAgent\StorageSync.Management.ServerCmdlets.dll"
Set-StorageSyncProxyConfiguration -Address <url> -Port <port number> -ProxyCredential <credentials>
# IP address or name of the proxy server.
$Address="http://127.0.0.1"
# The port to use for the connection to the proxy.
$Port=8080
# The user name for a proxy.
$UserName="user_name"
# Please type or paste a string with a password for the proxy.
$SecurePassword = Read-Host -AsSecureString
$Creds = New-Object System.Management.Automation.PSCredential ($UserName, $SecurePassword)
# Please verify that you have entered the password correctly.
Write-Host $Creds.GetNetworkCredential().Password
Import-Module "C:\Program Files\Azure\StorageSyncAgent\StorageSync.Management.ServerCmdlets.dll"
Set-StorageSyncProxyConfiguration -Address $Address -Port $Port -ProxyCredential $Creds
Import-Module "C:\Program Files\Azure\StorageSyncAgent\StorageSync.Management.ServerCmdlets.dll"
Test-StorageSyncNetworkConnectivity
# The specific region to get the IP address ranges for. Replace westus2 with the desired region code
# from Get-AzLocation.
$region = "westus2"
# The service tag for Azure File Sync. Don't change unless you're adapting this
# script for another service.
$serviceTag = "StorageSyncService"
# Download date is the string matching the JSON document on the Download Center.
$possibleDownloadDates = 0..7 | `
ForEach-Object { [System.DateTime]::Now.AddDays($_ * -1).ToString("yyyyMMdd") }
# Verify the provided region
$validRegions = Get-AzLocation | `
Where-Object { $_.Providers -contains "Microsoft.StorageSync" } | `
Select-Object -ExpandProperty Location
if ($validRegions -notcontains $region) {
Write-Error `
-Message "The specified region $region isn't available. Either Azure File Sync isn't deployed there or the region doesn't exist." `
-ErrorAction Stop
}
# Get the Azure cloud. This should automatically based on the context of
# your Az PowerShell login, however if you manually need to populate, you can find
# the correct values using Get-AzEnvironment.
$azureCloud = Get-AzContext | `
Select-Object -ExpandProperty Environment | `
Select-Object -ExpandProperty Name
# Build the download URI
$downloadUris = @()
switch($azureCloud) {
"AzureCloud" {
$downloadUris = $possibleDownloadDates | ForEach-Object {
"https://download.microsoft.com/download/7/1/D/71D86715-5596-4529-9B13-DA13A5DE5B63/ServiceTags_Public_$_.json"
}
}
"AzureUSGovernment" {
$downloadUris = $possibleDownloadDates | ForEach-Object {
"https://download.microsoft.com/download/6/4/D/64DB03BF-895B-4173-A8B1-BA4AD5D4DF22/ServiceTags_AzureGovernment_$_.json"
}
}
"AzureChinaCloud" {
$downloadUris = $possibleDownloadDates | ForEach-Object {
"https://download.microsoft.com/download/9/D/0/9D03B7E2-4B80-4BF3-9B91-DA8C7D3EE9F9/ServiceTags_China_$_.json"
}
}
"AzureGermanCloud" {
$downloadUris = $possibleDownloadDates | ForEach-Object {
"https://download.microsoft.com/download/0/7/6/076274AB-4B0B-4246-A422-4BAF1E03F974/ServiceTags_AzureGermany_$_.json"
}
}
default {
Write-Error -Message "Unrecognized Azure Cloud: $_" -ErrorAction Stop
}
}
# Find most recent file
$found = $false
foreach($downloadUri in $downloadUris) {
try { $response = Invoke-WebRequest -Uri $downloadUri -UseBasicParsing } catch { }
if ($response.StatusCode -eq 200) {
$found = $true
break
}
}
if ($found) {
# Get the raw JSON
$content = [System.Text.Encoding]::UTF8.GetString($response.Content)
# Parse the JSON
$serviceTags = ConvertFrom-Json -InputObject $content -Depth 100
# Get the specific $ipAddressRanges
$ipAddressRanges = $serviceTags | `
Select-Object -ExpandProperty values | `
Where-Object { $_.id -eq "$serviceTag.$region" } | `
Select-Object -ExpandProperty properties | `
Select-Object -ExpandProperty addressPrefixes
} else {
# If the file cannot be found, that means there hasn't been an update in
# more than a week. Please verify the download URIs are still accurate
# by checking https://learn.microsoft.com/azure/virtual-network/service-tags-overview
Write-Verbose -Message "JSON service tag file not found."
return
}