Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.12k stars 3.76k forks source link

Update-AzCognitiveServicesAccountNetworkRuleSet (underlying REST api) fails for /31 and /32 networks #25455

Open SvenSowa opened 4 days ago

SvenSowa commented 4 days ago

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.

image

Issue script & Debug output

# this will grab IP ranges from Amazon AWS, filter them by region "eu-central-1" and remove duplicates
$url = "https://ip-ranges.amazonaws.com/ip-ranges.json"
$fileName = [System.IO.Path]::GetTempFileName()
$x = Invoke-WebRequest -Uri $url -OutFile $fileName
$ranges = Get-Content -Path $fileName | ConvertFrom-Json
$regionRanges = $ranges | select -ExpandProperty prefixes | where region -eq "eu-central-1" | select -ExpandProperty ip_prefix 
$regionRangesUnique = $regionRanges | select -Unique
$genList = New-Object System.Collections.Generic.List[Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSIpRule]
$regionRangesUnique | foreach {          
    $ipRange = $_
    $ipRule = New-Object Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSIpRule;
    $ipRule.IpAddress = $ipRange;
    [void]$genList.Add($ipRule)
}

Update-AzCognitiveServicesAccountNetworkRuleSet -ResourceGroupName "MyResourceGroup" -Name "MyCognitiveService" -DefaultAction Allow -IpRule $genList

DEBUG: 09:36:26 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:36:26 - UpdateAzureCognitiveServicesAccountNetworkRuleSetCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 09:36:26 - using account id '%MYUSER%'...
DEBUG: 09:36:26 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value
[True].
DEBUG: [Common.Authentication]: Authenticating using Account: '%MYUSER%', environment: 'AzureCloud', tenant:
'%MYTENANT%'
DEBUG: 09:36:26 - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 09:36:26 - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:36:26 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync -
TenantId:'%MYTENANT%', Scopes:'https://management.core.windows.net//.default',
AuthorityHost:'https://login.microsoftonline.com/', UserId:'%MYUSER%'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
bc25a98f-2bd2-4f5b-a39c-0b11c778cbfc] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
bc25a98f-2bd2-4f5b-a39c-0b11c778cbfc] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
bc25a98f-2bd2-4f5b-a39c-0b11c778cbfc] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
bc25a98f-2bd2-4f5b-a39c-0b11c778cbfc] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
bc25a98f-2bd2-4f5b-a39c-0b11c778cbfc] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
bc25a98f-2bd2-4f5b-a39c-0b11c778cbfc] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
bc25a98f-2bd2-4f5b-a39c-0b11c778cbfc] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [Runtime] WAM
supported OS.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [RuntimeBroker]
ListWindowsWorkAndSchoolAccounts option was not enabled.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
e49a655b-10bf-4d6e-ad51-0e5f1dd5c225] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] Found 3 cache
accounts and 0 broker accounts
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] Returning 3
accounts
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] MSAL MSAL.CoreCLR with assembly version '4.60.3.0'.
CorrelationId(9e6134ab-ec31-4df5-8156-aa9dbd64076b)
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] LoginHint provided: False
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] Account provided: True
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] ForceRefresh: False
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - True
HomeAccountId - False
CorrelationId - 9e6134ab-ec31-4df5-8156-aa9dbd64076b
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] === Token Acquisition (SilentRequest) started:
  Scopes: https://management.core.windows.net//.default
 Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] Broker is configured and enabled, attempting to use broker instead.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [Runtime] WAM
supported OS.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] Can invoke broker. Will attempt to acquire token with broker.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0053] WARNING
 SetAuthorityString:98 Initializing authority from string 'https://login.microsoftonline.com/%MYTENANT%/'
without authority type, defaulting to MsSts
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:393 Printing Telemetry for Correlation ID: 9e6134ab-ec31-4df5-8156-aa9dbd64076b
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: start_time, Value: 2024-07-04T07:36:26.000Z
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: api_name, Value: ReadAccountById
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: was_request_throttled, Value: false
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: authority_type, Value: Unknown
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: msal_version, Value: 1.1.0+local
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: correlation_id, Value: 9e6134ab-ec31-4df5-8156-aa9dbd64076b
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: broker_app_used, Value: false
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: stop_time, Value: 2024-07-04T07:36:26.000Z
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: msalruntime_version, Value: 0.16.0
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: is_successful, Value: true
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 LogTelemetryData:401 Key: request_duration, Value: 0
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 SetCorrelationId:273 Set correlation ID: 9e6134ab-ec31-4df5-8156-aa9dbd64076b
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 EnqueueBackgroundRequest:952 The original authority is 'https://login.microsoftonline.com/%MYTENANT%'
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 ModifyAndValidateAuthParameters:191 Additional query parameter added successfully. Key: '(pii)' Value: '(pii)'
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0116] INFO
 ModifyAndValidateAuthParameters:215 Authority Realm: %MYTENANT%
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 StorageTokenResponse:84 StorageTokenResponse account constructor invoked. This is only expected in Runtime flows
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:393 Printing Telemetry for Correlation ID: 9e6134ab-ec31-4df5-8156-aa9dbd64076b
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: start_time, Value: 2024-07-04T07:36:26.000Z
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: api_name, Value: AcquireTokenSilently
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: was_request_throttled, Value: false
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: authority_type, Value: AAD
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: access_token_expiry_time, Value: 2024-07-04T08:25:00.000Z
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: read_token, Value: ID|AT
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: msal_version, Value: 1.1.0+local
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: client_id, Value: 1950a258-227b-4e31-a9cf-717495945fc2
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: correlation_id, Value: 9e6134ab-ec31-4df5-8156-aa9dbd64076b
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: broker_app_used, Value: false
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: stop_time, Value: 2024-07-04T07:36:26.000Z
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: msalruntime_version, Value: 0.16.0
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: original_authority, Value: https://login.microsoftonline.com/%MYTENANT%
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: additional_query_parameters_count, Value: 1
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: storage_read, Value: DAC|DAT|DID
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: auth_flow, Value: AT
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: is_successful, Value: true
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: authorization_type, Value: WindowsIntegratedAuth
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:401 Key: request_duration, Value: 3
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:406 Printing Execution Flow:
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [MSAL:0003] INFO
 LogTelemetryData:414
{"t":"4s7uc","tid":116,"ts":0,"l":2},{"t":"4sufd","tid":116,"ts":0,"s":2,"l":2},{"t":"4swgg","tid":116,"ts":0,"s":106,"l":2},{"t":"4swgf",
"tid":116,"ts":0,"s":1,"l":2},{"t":"4swgi","tid":3,"ts":0,"s":106,"l":2},{"t":"8b2yn","tid":3,"ts":0,"l":2},{"t":"8dqkx","tid":3,"ts":1,"l
":2},{"t":"8dqik","tid":3,"ts":1,"l":2},{"t":"4q2di","tid":3,"ts":1,"l":2},{"t":"4qnng","tid":3,"ts":1,"l":2,"a":2,"ie":0},{"t":"4qnnf","t
id":3,"ts":1,"l":2,"a":2,"ie":1},{"t":"8dqit","tid":3,"ts":1,"l":2},{"t":"8b2ht","tid":3,"ts":1,"l":2},{"t":"4qnno","tid":3,"ts":1,"l":2,"
a":2,"ie":0},{"t":"4qnnn","tid":3,"ts":4,"l":2,"a":2,"ie":1},{"t":"6xuag","tid":3,"ts":4,"l":2}
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z] [RuntimeBroker] WAM
 response status success
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] Checking MsalTokenResponse returned from broker.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] Success. Response contains an access token.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] Checking client info returned from the server..
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] Saving token response to cache..
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] [Instance Discovery] Instance discovery is enabled and will be performed
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] [SaveTokenResponseAsync] Saving Id Token and Account in cache ...
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b]
 === Token Acquisition finished successfully:
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b]  AT expiration time: 04.07.2024 08:24:59 +00:00, scopes:
https://management.core.windows.net//.default https://management.core.windows.net//user_impersonation. source: Broker
DEBUG: False MSAL 4.60.3.0 MSAL.CoreCLR .NET Framework 4.8.4712.0 Microsoft Windows 10.0.19045  [2024-07-04 07:36:26Z -
9e6134ab-ec31-4df5-8156-aa9dbd64076b] Fetched access token from host login.microsoftonline.com.
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
ExpiresOn: 2024-07-04T08:24:59.7405203+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '%MYTENANT%', UserId:
'%MYUSER%'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/%MYSUBSCRIPTION%/resourceGroups/open-ai/providers/Microsoft.CognitiveServic
es/accounts/%MYCOGNITIVERESOURCE%?api-version=2023-05-01

Headers:
x-ms-client-request-id        : bbbb4c5b-1f4f-477a-a8c1-162acc6c0c15
accept-language               : en-US

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma                        : no-cache
X-Content-Type-Options        : nosniff
x-ms-request-id               : 821e8b17-cac8-4759-b2b9-eef351824b24
x-envoy-upstream-service-time : 9
x-ms-ratelimit-remaining-subscription-reads: 249
x-ms-ratelimit-remaining-subscription-global-reads: 3749
x-ms-correlation-request-id   : 82964131-76db-45f3-b3f2-d020f67f92ad
x-ms-routing-request-id       : GERMANYWESTCENTRAL:20240704T073625Z:82964131-76db-45f3-b3f2-d020f67f92ad
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: A629AC011099468C9A11057AD631E09C Ref B: VIEEDGE1414 Ref C: 2024-07-04T07:36:25Z
Cache-Control                 : no-cache
Date                          : Thu, 04 Jul 2024 07:36:24 GMT
ETag                          : "a900946e-0000-4700-0000-6686506f0000"

Body:
{
  "id":
"/subscriptions/%MYSUBSCRIPTION%/resourceGroups/open-ai/providers/Microsoft.CognitiveServices/accounts/%MYCOGNITIVERESOURCE%",
  "name": "%MYCOGNITIVERESOURCE%",
  "type": "Microsoft.CognitiveServices/accounts",
  "etag": "\"a900946e-0000-4700-0000-6686506f0000\"",
  "location": "swedencentral",
  "sku": {
    "name": "S0"
  },
  "kind": "OpenAI",
  "tags": {},
  "properties": {
    "endpoint": "https://%MYCOGNITIVERESOURCE%.openai.azure.com/",
    "provisioningState": "Succeeded",
    "internalId": "9736f81228d64514b94060a0f56fb35a",
    "dateCreated": "2023-10-09T08:18:55.7551723Z",
    "callRateLimit": {
      "rules": [
        {
          "key": "openai.dalle.post",
          "renewalPeriod": 1,
          "count": 30,
          "matchPatterns": [
            {
              "path": "dalle/*",
              "method": "POST"
            },
            {
              "path": "openai/images/*",
              "method": "POST"
            }
          ]
        },
        {
          "key": "openai.dalle.other",
          "renewalPeriod": 1,
          "count": 30,
          "matchPatterns": [
            {
              "path": "dalle/*",
              "method": "*"
            },
            {
              "path": "openai/operations/images/*",
              "method": "*"
            }
          ]
        },
        {
          "key": "openai",
          "renewalPeriod": 1,
          "count": 30,
          "matchPatterns": [
            {
              "path": "openai/*",
              "method": "*"
            }
          ]
        },
        {
          "key": "default",
          "renewalPeriod": 1,
          "count": 30,
          "matchPatterns": [
            {
              "path": "*",
              "method": "*"
            }
          ]
        }
      ]
    },
    "isMigrated": false,
    "customSubDomainName": "%MYCOGNITIVERESOURCE%",
    "networkAcls": {
      "defaultAction": "Allow",
      "virtualNetworkRules": [],
      "ipRules": []
    },
    "privateEndpointConnections": [],
    "publicNetworkAccess": "Disabled",
    "capabilities": [
      {
        "name": "VirtualNetworks"
      },
      {
        "name": "CustomerManagedKey"
      },
      {
        "name": "MaxFineTuneCount",
        "value": "100"
      },
      {
        "name": "MaxRunningFineTuneCount",
        "value": "1"
      },
      {
        "name": "MaxUserFileCount",
        "value": "50"
      },
      {
        "name": "MaxTrainingFileSize",
        "value": "512000000"
      },
      {
        "name": "MaxUserFileImportDurationInHours",
        "value": "1"
      },
      {
        "name": "MaxFineTuneJobDurationInHours",
        "value": "720"
      },
      {
        "name": "TrustedServices",
        "value": "Microsoft.CognitiveServices,Microsoft.MachineLearningServices,Microsoft.Search"
      },
      {
        "name": "RaiMonitor"
      }
    ],
    "disableLocalAuth": true,
    "endpoints": {
      "OpenAI Language Model Instance API": "https://%MYCOGNITIVERESOURCE%.openai.azure.com/",
      "OpenAI Dall-E API": "https://%MYCOGNITIVERESOURCE%.openai.azure.com/",
      "OpenAI Whisper API": "https://%MYCOGNITIVERESOURCE%.openai.azure.com/",
      "OpenAI Model Scaleset API": "https://%MYCOGNITIVERESOURCE%.openai.azure.com/"
    }
  },
  "systemData": {
    "createdBy": "%MYUSER%",
    "createdByType": "User",
    "createdAt": "2023-10-09T08:18:54.6750061Z",
    "lastModifiedBy": "%MYUSER%",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2024-07-04T07:34:01.4754842Z"
  }
}

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PATCH

Absolute Uri:
https://management.azure.com/subscriptions/%MYSUBSCRIPTION%/resourceGroups/open-ai/providers/Microsoft.CognitiveServic
es/accounts/%MYCOGNITIVERESOURCE%?api-version=2023-05-01

Headers:
x-ms-client-request-id        : bbbb4c5b-1f4f-477a-a8c1-162acc6c0c15
accept-language               : en-US

Body:
{
  "properties": {
    "networkAcls": {
      "defaultAction": "Allow",
      "ipRules": [
        {
          "value": "13.34.9.100/32"
        },
        {
          "value": "15.230.15.29/32"
        },
        {
          "value": "15.230.15.76/31"
        },
        {
          "value": "52.93.244.0/24"
        },
        {
          "value": "52.219.170.0/23"
        },
        {
          "value": "13.34.8.228/32"
        },
        {
          "value": "13.34.9.68/32"
        },
        {
          "value": "13.34.105.96/27"
        },
        {
          "value": "52.219.168.0/24"
        },
        {
          "value": "52.93.126.135/32"
        },
        {
          "value": "15.230.15.104/31"
        },
        {
          "value": "15.230.15.162/31"
        },
        {
          "value": "18.96.32.0/19"
        },
        {
          "value": "13.34.73.96/27"
        },
        {
          "value": "15.230.15.48/31"
        },
        {
          "value": "13.34.9.75/32"
        },
        {
          "value": "15.230.15.178/31"
        },
        {
          "value": "15.230.15.188/31"
        },
        {
          "value": "16.12.32.0/22"
        },
        {
          "value": "16.12.24.0/21"
        },
        {
          "value": "13.34.106.0/27"
        },
        {
          "value": "15.230.15.25/32"
        },
        {
          "value": "15.230.15.94/31"
        },
        {
          "value": "15.230.15.72/31"
        },
        {
          "value": "3.5.136.0/22"
        },
        {
          "value": "13.34.8.200/32"
        },
        {
          "value": "15.230.15.126/31"
        },
        {
          "value": "15.230.241.0/24"
        },
        {
          "value": "52.219.72.0/22"
        },
        {
          "value": "15.230.15.118/31"
        },
        {
          "value": "18.192.0.0/15"
        },
        {
          "value": "52.93.126.132/32"
        },
        {
          "value": "64.252.89.0/24"
        },
        {
          "value": "13.34.8.234/32"
        },
        {
          "value": "13.34.101.64/27"
        },
        {
          "value": "15.230.15.164/31"
        },
        {
          "value": "15.230.15.176/31"
        },
        {
          "value": "99.78.156.0/22"
        },
        {
          "value": "63.176.0.0/14"
        },
        {
          "value": "13.34.87.224/27"
        },
        {
          "value": "13.34.9.66/32"
        },
        {
          "value": "15.230.15.120/31"
        },
        {
          "value": "150.222.86.0/24"
        },
        {
          "value": "13.34.8.193/32"
        },
        {
          "value": "104.153.114.0/24"
        },
        {
          "value": "15.230.15.192/31"
        },
        {
          "value": "99.77.136.0/24"
        },
        {
          "value": "15.230.15.58/31"
        },
        {
          "value": "150.222.245.122/31"
        },
        {
          "value": "13.34.9.107/32"
        },
        {
          "value": "15.230.15.102/31"
        },
        {
          "value": "15.230.15.90/31"
        },
        {
          "value": "13.34.8.199/32"
        },
        {
          "value": "15.230.15.52/31"
        },
        {
          "value": "15.230.15.208/31"
        },
        {
          "value": "150.222.27.0/24"
        },
        {
          "value": "13.34.5.0/27"
        },
        {
          "value": "3.2.53.0/24"
        },
        {
          "value": "15.230.15.136/31"
        },
        {
          "value": "13.34.92.64/27"
        },
        {
          "value": "15.230.15.28/32"
        },
        {
          "value": "15.230.15.170/31"
        },
        {
          "value": "15.230.15.32/31"
        },
        {
          "value": "15.145.2.0/23"
        },
        {
          "value": "52.219.211.0/24"
        },
        {
          "value": "173.82.255.0/24"
        },
        {
          "value": "52.93.127.238/32"
        },
        {
          "value": "13.34.8.229/32"
        },
        {
          "value": "15.230.15.160/31"
        },
        {
          "value": "63.180.0.0/14"
        },
        {
          "value": "13.34.9.110/32"
        },
        {
          "value": "13.34.92.96/27"
        },
        {
          "value": "15.230.15.168/31"
        },
        {
          "value": "15.230.15.200/31"
        },
        {
          "value": "15.230.15.30/32"
        },
        {
          "value": "150.222.5.0/24"
        },
        {
          "value": "13.34.8.198/32"
        },
        {
          "value": "13.34.33.64/27"
        },
        {
          "value": "13.34.106.32/27"
        },
        {
          "value": "15.230.15.150/31"
        },
        {
          "value": "52.58.0.0/15"
        },
        {
          "value": "15.230.15.74/31"
        },
        {
          "value": "13.34.8.233/32"
        },
        {
          "value": "15.220.48.0/21"
        },
        {
          "value": "15.230.15.8/32"
        },
        {
          "value": "15.230.15.255/32"
        },
        {
          "value": "18.184.0.0/15"
        },
        {
          "value": "13.34.8.227/32"
        },
        {
          "value": "13.34.9.67/32"
        },
        {
          "value": "13.34.88.128/27"
        },
        {
          "value": "15.230.15.182/31"
        },
        {
          "value": "15.230.111.0/24"
        },
        {
          "value": "52.57.0.0/16"
        },
        {
          "value": "150.222.120.0/24"
        },
        {
          "value": "13.34.73.160/27"
        },
        {
          "value": "13.248.97.0/24"
        },
        {
          "value": "150.222.213.0/24"
        },
        {
          "value": "54.93.0.0/16"
        },
        {
          "value": "13.34.8.235/32"
        },
        {
          "value": "3.124.0.0/14"
        },
        {
          "value": "13.34.47.0/27"
        },
        {
          "value": "13.34.106.160/27"
        },
        {
          "value": "13.34.5.64/27"
        },
        {
          "value": "15.230.15.112/31"
        },
        {
          "value": "15.230.65.0/26"
        },
        {
          "value": "13.34.106.96/27"
        },
        {
          "value": "35.96.96.0/20"
        },
        {
          "value": "136.18.18.0/24"
        },
        {
          "value": "15.220.64.0/20"
        },
        {
          "value": "3.33.35.0/24"
        },
        {
          "value": "15.230.15.138/31"
        },
        {
          "value": "52.95.255.128/28"
        },
        {
          "value": "150.222.10.0/24"
        },
        {
          "value": "15.230.15.142/31"
        },
        {
          "value": "13.34.8.196/32"
        },
        {
          "value": "13.34.9.70/32"
        },
        {
          "value": "15.220.152.0/21"
        },
        {
          "value": "54.239.54.0/23"
        },
        {
          "value": "15.230.15.31/32"
        },
        {
          "value": "18.156.0.0/14"
        },
        {
          "value": "15.230.15.100/31"
        },
        {
          "value": "15.230.15.180/31"
        },
        {
          "value": "13.34.5.32/27"
        },
        {
          "value": "15.220.144.0/23"
        },
        {
          "value": "15.230.65.64/26"
        },
        {
          "value": "54.239.64.0/21"
        },
        {
          "value": "15.230.64.192/26"
        },
        {
          "value": "52.219.210.0/24"
        },
        {
          "value": "15.230.15.15/32"
        },
        {
          "value": "13.34.33.0/27"
        },
        {
          "value": "13.34.98.128/27"
        },
        {
          "value": "15.230.15.44/31"
        },
        {
          "value": "15.230.15.172/31"
        },
        {
          "value": "35.96.48.0/20"
        },
        {
          "value": "15.230.15.64/31"
        },
        {
          "value": "52.93.126.133/32"
        },
        {
          "value": "13.34.47.64/27"
        },
        {
          "value": "15.230.15.98/31"
        },
        {
          "value": "52.94.69.0/24"
        },
        {
          "value": "15.230.15.70/31"
        },
        {
          "value": "52.93.127.139/32"
        },
        {
          "value": "64.252.87.0/24"
        },
        {
          "value": "15.230.15.26/32"
        },
        {
          "value": "15.230.15.152/31"
        },
        {
          "value": "150.222.35.128/25"
        },
        {
          "value": "15.230.15.122/31"
        },
        {
          "value": "150.222.104.0/24"
        },
        {
          "value": "151.148.17.0/24"
        },
        {
          "value": "13.34.9.72/32"
        },
        {
          "value": "13.34.33.96/27"
        },
        {
          "value": "15.230.15.202/31"
        },
        {
          "value": "13.34.9.102/32"
        },
        {
          "value": "15.230.15.5/32"
        },
        {
          "value": "15.230.15.206/31"
        },
        {
          "value": "13.34.9.65/32"
        },
        {
          "value": "15.230.15.214/31"
        },
        {
          "value": "15.230.15.130/31"
        },
        {
          "value": "15.145.0.0/23"
        },
        {
          "value": "15.230.15.116/31"
        },
        {
          "value": "13.34.105.64/27"
        },
        {
          "value": "99.77.158.0/24"
        },
        {
          "value": "13.34.8.197/32"
        },
        {
          "value": "150.222.122.0/24"
        },
        {
          "value": "15.230.15.50/31"
        },
        {
          "value": "13.34.8.238/32"
        },
        {
          "value": "150.222.139.124/30"
        },
        {
          "value": "13.34.8.226/32"
        },
        {
          "value": "15.230.15.154/31"
        },
        {
          "value": "52.93.127.237/32"
        },
        {
          "value": "13.34.47.32/27"
        },
        {
          "value": "3.64.0.0/12"
        },
        {
          "value": "15.230.15.108/31"
        },
        {
          "value": "151.148.35.0/24"
        },
        {
          "value": "13.34.8.195/32"
        },
        {
          "value": "13.34.87.192/27"
        },
        {
          "value": "150.222.36.0/25"
        },
        {
          "value": "13.34.33.160/27"
        },
        {
          "value": "52.94.198.48/28"
        },
        {
          "value": "15.230.85.0/24"
        },
        {
          "value": "13.34.8.206/32"
        },
        {
          "value": "13.34.9.98/32"
        },
        {
          "value": "15.145.12.0/22"
        },
        {
          "value": "13.34.8.202/32"
        },
        {
          "value": "15.230.15.88/31"
        },
        {
          "value": "15.230.15.156/31"
        },
        {
          "value": "15.230.15.42/31"
        },
        {
          "value": "99.77.247.0/24"
        },
        {
          "value": "15.230.15.174/31"
        },
        {
          "value": "64.252.88.0/24"
        },
        {
          "value": "15.230.15.184/31"
        },
        {
          "value": "13.34.8.232/32"
        },
        {
          "value": "15.230.15.46/31"
        },
        {
          "value": "52.94.136.0/21"
        },
        {
          "value": "54.239.4.0/22"
        },
        {
          "value": "15.230.15.68/31"
        },
        {
          "value": "13.34.112.160/27"
        },
        {
          "value": "15.230.15.86/31"
        },
        {
          "value": "15.230.15.146/31"
        },
        {
          "value": "15.230.15.24/32"
        },
        {
          "value": "15.230.15.27/32"
        },
        {
          "value": "15.230.15.96/31"
        },
        {
          "value": "52.94.204.0/23"
        },
        {
          "value": "15.230.15.13/32"
        },
        {
          "value": "52.29.0.0/16"
        },
        {
          "value": "52.144.209.0/26"
        },
        {
          "value": "99.78.160.0/21"
        },
        {
          "value": "99.151.188.0/23"
        },
        {
          "value": "15.230.144.0/24"
        },
        {
          "value": "13.34.106.64/27"
        },
        {
          "value": "15.193.4.0/24"
        },
        {
          "value": "54.239.106.0/23"
        },
        {
          "value": "15.230.15.9/32"
        },
        {
          "value": "15.230.15.128/31"
        },
        {
          "value": "99.78.168.0/23"
        },
        {
          "value": "15.230.15.190/31"
        },
        {
          "value": "99.150.16.0/21"
        },
        {
          "value": "3.120.0.0/14"
        },
        {
          "value": "18.198.0.0/15"
        },
        {
          "value": "15.230.15.140/31"
        },
        {
          "value": "13.34.9.104/32"
        },
        {
          "value": "15.230.15.11/32"
        },
        {
          "value": "15.230.15.84/31"
        },
        {
          "value": "15.230.15.110/31"
        },
        {
          "value": "13.34.9.79/32"
        },
        {
          "value": "15.230.131.0/24"
        },
        {
          "value": "52.94.248.112/28"
        },
        {
          "value": "15.230.15.134/31"
        },
        {
          "value": "52.219.218.0/24"
        },
        {
          "value": "13.34.98.160/27"
        },
        {
          "value": "15.230.80.0/24"
        },
        {
          "value": "13.34.88.160/27"
        },
        {
          "value": "15.230.15.106/31"
        },
        {
          "value": "15.230.15.186/31"
        },
        {
          "value": "15.221.3.0/24"
        },
        {
          "value": "15.230.15.60/31"
        },
        {
          "value": "15.230.15.166/31"
        },
        {
          "value": "13.34.8.203/32"
        },
        {
          "value": "13.34.9.99/32"
        },
        {
          "value": "15.230.15.114/31"
        },
        {
          "value": "52.144.210.192/26"
        },
        {
          "value": "13.34.9.74/32"
        },
        {
          "value": "52.94.17.0/24"
        },
        {
          "value": "15.230.15.204/31"
        },
        {
          "value": "13.34.9.73/32"
        },
        {
          "value": "15.230.15.62/31"
        },
        {
          "value": "13.34.8.201/32"
        },
        {
          "value": "13.248.123.0/24"
        },
        {
          "value": "15.230.15.38/31"
        },
        {
          "value": "13.34.8.194/32"
        },
        {
          "value": "35.156.0.0/14"
        },
        {
          "value": "15.230.15.10/32"
        },
        {
          "value": "52.219.44.0/22"
        },
        {
          "value": "13.34.5.96/27"
        },
        {
          "value": "13.34.8.239/32"
        },
        {
          "value": "13.34.33.128/27"
        },
        {
          "value": "52.219.169.0/24"
        },
        {
          "value": "15.145.16.0/22"
        },
        {
          "value": "54.239.0.160/28"
        },
        {
          "value": "15.145.4.0/23"
        },
        {
          "value": "150.222.139.116/30"
        },
        {
          "value": "15.230.15.7/32"
        },
        {
          "value": "15.230.15.216/31"
        },
        {
          "value": "15.230.52.0/24"
        },
        {
          "value": "13.34.9.101/32"
        },
        {
          "value": "13.34.33.32/27"
        },
        {
          "value": "15.230.15.4/32"
        },
        {
          "value": "52.219.140.0/24"
        },
        {
          "value": "63.184.0.0/13"
        },
        {
          "value": "13.34.9.97/32"
        },
        {
          "value": "18.153.0.0/16"
        },
        {
          "value": "13.34.8.231/32"
        },
        {
          "value": "173.83.196.0/23"
        },
        {
          "value": "99.83.99.0/24"
        },
        {
          "value": "15.230.15.254/32"
        },
        {
          "value": "52.93.127.138/32"
        },
        {
          "value": "150.222.139.120/30"
        },
        {
          "value": "15.230.15.54/31"
        },
        {
          "value": "15.230.15.210/31"
        },
        {
          "value": "13.34.73.128/27"
        },
        {
          "value": "13.34.111.160/27"
        },
        {
          "value": "13.34.9.69/32"
        },
        {
          "value": "150.222.230.0/24"
        },
        {
          "value": "13.34.111.128/27"
        },
        {
          "value": "54.239.56.0/21"
        },
        {
          "value": "64.252.86.0/24"
        },
        {
          "value": "18.196.0.0/15"
        },
        {
          "value": "13.34.47.96/27"
        },
        {
          "value": "15.230.15.218/31"
        },
        {
          "value": "15.230.15.14/32"
        },
        {
          "value": "15.230.15.148/31"
        },
        {
          "value": "13.34.8.230/32"
        },
        {
          "value": "15.230.15.0/32"
        },
        {
          "value": "15.230.15.40/31"
        },
        {
          "value": "52.95.248.0/24"
        },
        {
          "value": "15.230.15.56/31"
        },
        {
          "value": "13.34.8.207/32"
        },
        {
          "value": "15.230.15.158/31"
        },
        {
          "value": "52.94.146.0/24"
        },
        {
          "value": "52.144.211.0/26"
        },
        {
          "value": "13.34.9.106/32"
        },
        {
          "value": "18.89.0.0/18"
        },
        {
          "value": "18.194.0.0/15"
        },
        {
          "value": "99.82.163.0/24"
        },
        {
          "value": "52.46.184.0/22"
        },
        {
          "value": "52.93.111.0/24"
        },
        {
          "value": "13.34.9.71/32"
        },
        {
          "value": "13.34.9.111/32"
        },
        {
          "value": "13.34.112.128/27"
        },
        {
          "value": "15.230.15.6/32"
        },
        {
          "value": "15.230.15.132/31"
        },
        {
          "value": "52.119.188.0/22"
        },
        {
          "value": "15.230.15.82/31"
        },
        {
          "value": "13.34.8.225/32"
        },
        {
          "value": "13.34.73.64/27"
        },
        {
          "value": "13.34.101.96/27"
        },
        {
          "value": "15.230.15.194/31"
        },
        {
          "value": "52.219.208.0/23"
        },
        {
          "value": "150.222.4.0/24"
        },
        {
          "value": "150.222.129.0/24"
        },
        {
          "value": "13.34.9.76/32"
        },
        {
          "value": "13.34.9.105/32"
        },
        {
          "value": "15.230.15.16/32"
        },
        {
          "value": "15.230.15.36/31"
        },
        {
          "value": "15.230.15.78/31"
        },
        {
          "value": "15.230.15.66/31"
        },
        {
          "value": "52.93.23.0/24"
        },
        {
          "value": "99.83.103.0/24"
        },
        {
          "value": "15.230.15.34/31"
        },
        {
          "value": "15.230.15.144/31"
        },
        {
          "value": "13.34.106.128/27"
        },
        {
          "value": "52.93.126.134/32"
        },
        {
          "value": "35.71.105.0/24"
        },
        {
          "value": "52.28.0.0/16"
        },
        {
          "value": "13.34.9.103/32"
        },
        {
          "value": "15.145.8.0/22"
        },
        {
          "value": "15.230.15.92/31"
        },
        {
          "value": "15.230.15.212/31"
        },
        {
          "value": "150.222.35.0/25"
        },
        {
          "value": "3.5.134.0/23"
        },
        {
          "value": "13.34.9.78/32"
        },
        {
          "value": "15.230.15.124/31"
        },
        {
          "value": "15.177.68.0/23"
        },
        {
          "value": "15.230.15.3/32"
        },
        {
          "value": "15.230.15.80/31"
        },
        {
          "value": "18.153.115.128/26"
        },
        {
          "value": "18.153.115.192/26"
        },
        {
          "value": "18.153.40.0/22"
        },
        {
          "value": "18.157.237.128/26"
        },
        {
          "value": "18.157.237.192/26"
        },
        {
          "value": "18.157.71.192/26"
        },
        {
          "value": "18.199.211.0/24"
        },
        {
          "value": "3.122.128.0/23"
        },
        {
          "value": "3.123.12.192/26"
        },
        {
          "value": "3.127.48.128/26"
        },
        {
          "value": "3.70.212.128/26"
        },
        {
          "value": "3.74.148.128/26"
        },
        {
          "value": "3.75.112.0/24"
        },
        {
          "value": "3.78.202.0/23"
        },
        {
          "value": "3.78.204.0/22"
        },
        {
          "value": "35.159.158.0/23"
        },
        {
          "value": "3.65.246.0/28"
        },
        {
          "value": "3.65.246.16/28"
        },
        {
          "value": "18.192.142.0/23"
        },
        {
          "value": "18.199.68.0/22"
        },
        {
          "value": "18.199.72.0/22"
        },
        {
          "value": "18.199.76.0/22"
        },
        {
          "value": "35.158.136.0/24"
        },
        {
          "value": "52.57.254.0/24"
        },
        {
          "value": "18.184.2.128/25"
        },
        {
          "value": "35.158.127.64/26"
        },
        {
          "value": "18.184.138.224/27"
        },
        {
          "value": "18.184.203.128/27"
        },
        {
          "value": "3.68.251.232/29"
        },
        {
          "value": "35.157.127.248/29"
        },
        {
          "value": "18.153.168.0/23"
        },
        {
          "value": "3.123.14.0/24"
        },
        {
          "value": "3.123.15.0/25"
        },
        {
          "value": "3.127.74.0/23"
        },
        {
          "value": "3.66.172.0/24"
        },
        {
          "value": "3.70.195.128/25"
        },
        {
          "value": "3.70.195.64/26"
        },
        {
          "value": "3.70.211.0/25"
        },
        {
          "value": "3.71.104.0/24"
        },
        {
          "value": "3.71.120.0/22"
        },
        {
          "value": "3.72.168.0/24"
        },
        {
          "value": "3.72.33.128/25"
        },
        {
          "value": "18.196.161.0/27"
        },
        {
          "value": "18.196.161.184/29"
        },
        {
          "value": "18.196.161.192/29"
        },
        {
          "value": "18.196.161.200/29"
        },
        {
          "value": "18.196.161.32/27"
        },
        {
          "value": "18.196.161.80/29"
        },
        {
          "value": "18.196.161.88/29"
        },
        {
          "value": "3.120.181.224/27"
        },
        {
          "value": "3.123.44.0/27"
        },
        {
          "value": "3.123.44.128/27"
        },
        {
          "value": "3.123.44.160/27"
        },
        {
          "value": "3.123.44.80/28"
        },
        {
          "value": "3.123.44.96/27"
        },
        {
          "value": "3.64.1.0/26"
        },
        {
          "value": "3.64.1.128/26"
        },
        {
          "value": "3.64.1.192/29"
        },
        {
          "value": "3.64.1.200/29"
        },
        {
          "value": "3.64.1.64/26"
        },
        {
          "value": "3.65.124.0/22"
        },
        {
          "value": "3.65.128.0/22"
        },
        {
          "value": "3.65.132.0/22"
        },
        {
          "value": "18.153.184.84/31"
        },
        {
          "value": "18.153.184.88/30"
        },
        {
          "value": "3.64.226.232/29"
        },
        {
          "value": "3.64.226.240/30"
        },
        {
          "value": "3.120.181.40/29"
        },
        {
          "value": "18.153.184.142/31"
        },
        {
          "value": "18.153.184.148/30"
        },
        {
          "value": "18.156.52.0/24"
        },
        {
          "value": "18.156.54.0/23"
        },
        {
          "value": "18.192.216.0/22"
        },
        {
          "value": "52.59.127.0/24"
        },
        {
          "value": "3.127.48.244/30"
        },
        {
          "value": "3.127.48.248/30"
        },
        {
          "value": "3.68.251.176/30"
        },
        {
          "value": "3.77.79.224/29"
        },
        {
          "value": "3.77.79.232/29"
        }
      ],
      "virtualNetworkRules": []
    }
  }
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
X-Content-Type-Options        : nosniff
x-ms-request-id               : 4045d21d-4fd8-4588-b501-1bd558bfa994
x-envoy-upstream-service-time : 41
x-ms-ratelimit-remaining-subscription-writes: 199
x-ms-ratelimit-remaining-subscription-global-writes: 2999
x-ms-correlation-request-id   : 58833e16-7c3b-4f93-b0e9-eab389a6bcc0
x-ms-routing-request-id       : SWITZERLANDNORTH:20240704T073627Z:58833e16-7c3b-4f93-b0e9-eab389a6bcc0
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: E3FF2CFA63994C278ABF8EF0E7AC6D69 Ref B: VIEEDGE1414 Ref C: 2024-07-04T07:36:25Z
Cache-Control                 : no-cache
Date                          : Thu, 04 Jul 2024 07:36:27 GMT

Body:
{
  "error": {
    "code": "BadRequest",
    "message": "Invalid IP address or range 13.34.9.100/32."
  }
}

DEBUG: 09:36:29 - [ConfigManager] Got nothing from [EnableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value
[False].
Update-AzCognitiveServicesAccountNetworkRuleSet : Operation returned an invalid status code 'BadRequest'
At line:1 char:1
+ Update-AzCognitiveServicesAccountNetworkRuleSet -ResourceGroupName "o ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Update-AzCognit...tNetworkRuleSet], ErrorResponseException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.CognitiveServices.UpdateAzureCognitiveServicesAccountNetworkRuleSetComm
   and

DEBUG: 09:36:29 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value
[True].
DEBUG: 09:36:29 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:36:29 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.CognitiveServices:1.14.1; CommandName: Update-AzCognitiveServicesAccountNetworkRuleSet; PSVersion:
5.1.19041.4412; IsSuccess: False; Duration: 00:00:03.1286766; SanitizeDuration: 00:00:00; Exception: Operation returned an invalid status
code 'BadRequest';
DEBUG: 09:36:29 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:36:29 - UpdateAzureCognitiveServicesAccountNetworkRuleSetCommand end processing.

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.4412
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4412
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     3.0.0      Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}
Script     1.14.1     Az.CognitiveServices                {Add-AzCognitiveServicesAccountNetworkRule, Get-AzCognitiveServicesAccount, G...
Script     0.13.0     Az.Reservations                     {Get-AzReservation, Get-AzReservationAvailableScope, Get-AzReservationCatalog...

Error output

DEBUG: 09:54:24 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:54:24 - ResolveError begin processing with ParameterSet 'LastErrorParameterSet'.
DEBUG: 09:54:24 - using account id '%MYUSER%'...
DEBUG: 09:54:24 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value
[True].
DEBUG: 09:54:24 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

   HistoryId: 245

Message        : Operation returned an invalid status code 'BadRequest'
StackTrace     :    at Microsoft.Azure.Management.CognitiveServices.AccountsOperations.<BeginUpdateWithHttpMessagesAsync>d__17.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.CognitiveServices.AccountsOperations.<UpdateWithHttpMessagesAsync>d__6.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.CognitiveServices.AccountsOperationsExtensions.<UpdateAsync>d__3.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at Microsoft.Azure.Management.CognitiveServices.AccountsOperationsExtensions.Update(IAccountsOperations operations,
                 String resourceGroupName, String accountName, Account account)
                    at Microsoft.Azure.Commands.Management.CognitiveServices.UpdateAzureCognitiveServicesAccountNetworkRuleSetCommand.Exec
                 uteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Microsoft.Azure.Management.CognitiveServices.Models.ErrorResponseException
InvocationInfo : {Update-AzCognitiveServicesAccountNetworkRuleSet}
Line           : Update-AzCognitiveServicesAccountNetworkRuleSet -ResourceGroupName "open-ai" -Name "%MYCOGNITIVERESOURCE%" -DefaultAction Allow
                 -IpRule $genList
Position       : At line:1 char:1
                 + Update-AzCognitiveServicesAccountNetworkRuleSet -ResourceGroupName "o ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 245

DEBUG: 09:54:24 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:54:24 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:3.0.0; CommandName: Resolve-AzError; PSVersion: 5.1.19041.4412; IsSuccess: True; Duration:
00:00:00.0424467; SanitizeDuration: 00:00:00.0122972
DEBUG: 09:54:24 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 09:54:24 - ResolveError end processing.
SvenSowa commented 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)
    } 
}