Open SvenSowa opened 4 days ago
Workaround:
$regionRangesUnique | foreach {
$ipRange = $_
# fix /32 bug
$ipRange = $ipRange.Replace("/32","");
# fix /31 bug
if ($ipRange -match "/31")
{
$pieces = $ipRange.split("/")
$ip1 = $pieces[0] # IP1
$numbers = $pieces[0].split(".")
$numbers[-1] = [int]$numbers[-1]+1
$ip2 = $numbers -join "."
$ipRule1 = New-Object Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSIpRule;
$ipRule1.IpAddress = $ip1;
[void]$genList.Add($ipRule1)
$ipRule2 = New-Object Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSIpRule;
$ipRule2.IpAddress = $ip2;
[void]$genList.Add($ipRule2)
}
else
{
$ipRule = New-Object Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSIpRule;
$ipRule.IpAddress = $ipRange;
[void]$genList.Add($ipRule)
}
}
Description
When specifying /31 or /32 networks, the api call to https://management.azure.com will fail with "Invalid IP address or range 13.34.9.100/32.". Other Azure services like NSG, Function App or SQL Server allow that and they are valid as well. I am grabbing the public IP ranges from Amazon AWS for a certain region and want to apply them as allowed networks.
Issue script & Debug output
Environment data
Module versions
Error output