azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Set-AzIpGroup is not honoring -whatIf

Open AndrevdG opened this issue 3 years ago • 1 comments

Description

All 'AzIpGroup' cmdlets that make changes support the -whatIf parameters. New-AzIpGroup and Remove-AzIpGroup honor this, displaying a "What If: " message and not making changes.

Set-AzIpGroup supports -whatif according to the documentation and accepts the parameter, but ignores it and changes the configuration of the resource instead.

Issue script & Debug output

Set-AzIpGroup -IpGroup $group -WhatIf
DEBUG: 12:09:54 - SetIpGroupsCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 12:09:54 - using account id '<userId>'...
DEBUG: [Common.Authentication]: Authenticating using Account: '<userId>', environment: 'AzureCloud', tenant: '<guid>'
DEBUG: 12:09:54 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'<GUID>', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'<UserId>'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] Azure region was not configured or could not be discovered. Not using a regional authority.
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54] Found 1 cache accounts and 0 broker accounts
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54] Returning 1 accounts
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] MSAL MSAL.NetCore with assembly version '4.30.1.0'. CorrelationId(9704cc93-f204-4128-9a70-7f45631e27aa)
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] === AcquireTokenSilent Parameters ===
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] LoginHint provided: False
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] Account provided: True
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] ForceRefresh: False
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ]
=== 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 - False
HomeAccountId - False
CorrelationId - 9704cc93-f204-4128-9a70-7f45631e27aa

DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] === Token Acquisition (SilentRequest) started:

        Authority Host: login.microsoftonline.com
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] Azure region was not configured or could not be discovered. Not using a regional authority.
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] Access token is not expired. Returning the found cache entry. [Current time (09/08/2022 10:09:54) - Expiration Time (09/08/2022 11:02:33 +00:00) - Extended Expiration Time (09/08/2022 11:02:33 +00:00)]
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] Returning access token found in cache. RefreshOn exists ? False
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] Fetched access token from host login.microsoftonline.com.
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.22622 [09/08/2022 10:09:54 - ] === Token Acquisition finished successfully. An access token was returned with Expiration Time: 09/08/2022 11:02:33 +00:00 and Scopes https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2022-09-08T11:02:33.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '<GUID>', UserId: '<UserId>'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Network/ipGroups/myGroup?api-version=2021-05-01

Headers:
x-ms-client-request-id        : 0fbf22ea-6dd4-4bc5-bee1-d14a88d7fcc6
Accept-Language               : en-US

Body:



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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
ETag                          : "6ab84b66-c3ec-42cf-9551-014a04ec9b11"
Server                        : Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-request-id               : e4bc67a5-ebc4-424d-bcfd-5e82185c4374
x-ms-correlation-request-id   : e4bc67a5-ebc4-424d-bcfd-5e82185c4374
x-ms-routing-request-id       : WESTEUROPE:20220908T100954Z:e4bc67a5-ebc4-424d-bcfd-5e82185c4374
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Thu, 08 Sep 2022 10:09:54 GMT

Body:
{
  "properties": {
    "firewalls": [],
    "firewallPolicies": [],
    "ipAddresses": [
      "192.168.1.4",
      "192.168.1.5"
    ],
    "provisioningState": "Succeeded"
  },
  "id": "/subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Network/ipGroups/myGroup",
  "name": "myGroup",
  "type": "Microsoft.Network/IpGroups",
  "etag": "6ab84b66-c3ec-42cf-9551-014a04ec9b11",
  "location": "westeurope"
}


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

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Network/ipGroups/myGroup?api-version=2021-05-01

Headers:
x-ms-client-request-id        : 0fbf22ea-6dd4-4bc5-bee1-d14a88d7fcc6
Accept-Language               : en-US

Body:
{
  "properties": {
    "ipAddresses": [
      "192.168.1.4",
      "192.168.1.5"
    ]
  },
  "id": "/subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Network/ipGroups/myGroup",
  "location": "westeurope"
}


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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Retry-After                   : 10
x-ms-request-id               : 4509026a-f45c-4e5c-87c6-902e01529b3f,4509026a-f45c-4e5c-87c6-902e01529b3f
x-ms-correlation-request-id   : da97860b-c2d5-4ae3-8a48-c85438337717
Azure-AsyncOperation          : https://management.azure.com/subscriptions/<subscriptionGUID>/providers/Microsoft.Network/locations/westeurope/nfvOperations/4509026a-f45c-4e5c-87c6-902e01529b3f?api-version=2021-05-01
Server                        : Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-routing-request-id       : WESTEUROPE:20220908T100954Z:da97860b-c2d5-4ae3-8a48-c85438337717
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Thu, 08 Sep 2022 10:09:54 GMT

Body:
{
  "properties": {
    "firewalls": [],
    "firewallPolicies": [],
    "ipAddresses": [
      "192.168.1.4",
      "192.168.1.5"
    ],
    "provisioningState": "Updating"
  },
  "id": "/subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Network/ipGroups/myGroup",
  "name": "myGroup",
  "type": "Microsoft.Network/IpGroups",
  "etag": "75de7143-17e6-436c-adf4-d289d39695b7",
  "location": "westeurope"
}


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

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/<subscriptionGUID>/providers/Microsoft.Network/locations/westeurope/nfvOperations/4509026a-f45c-4e5c-87c6-902e01529b3f?api-version=2021-05-01

Headers:
x-ms-client-request-id        : 0fbf22ea-6dd4-4bc5-bee1-d14a88d7fcc6

Body:



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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-request-id               : dc4071d5-8617-430f-8d68-63e602bef81d,dc4071d5-8617-430f-8d68-63e602bef81d
x-ms-correlation-request-id   : 96817b6d-2269-4264-a0e7-8a353fd4ac99
Server                        : Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11998
x-ms-routing-request-id       : WESTEUROPE:20220908T101005Z:96817b6d-2269-4264-a0e7-8a353fd4ac99
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Thu, 08 Sep 2022 10:10:04 GMT

Body:
{
  "status": "Succeeded"
}


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

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Network/ipGroups/myGroup?api-version=2021-05-01

Headers:
x-ms-client-request-id        : 0fbf22ea-6dd4-4bc5-bee1-d14a88d7fcc6

Body:



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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
ETag                          : "75de7143-17e6-436c-adf4-d289d39695b7"
Server                        : Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11997
x-ms-request-id               : fe0a4e45-294b-44ff-98fd-0a7ec9c10975
x-ms-correlation-request-id   : fe0a4e45-294b-44ff-98fd-0a7ec9c10975
x-ms-routing-request-id       : WESTEUROPE:20220908T101005Z:fe0a4e45-294b-44ff-98fd-0a7ec9c10975
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Thu, 08 Sep 2022 10:10:05 GMT

Body:
{
  "properties": {
    "firewalls": [],
    "firewallPolicies": [],
    "ipAddresses": [
      "192.168.1.4",
      "192.168.1.5"
    ],
    "provisioningState": "Succeeded"
  },
  "id": "/subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Network/ipGroups/myGroup",
  "name": "myGroup",
  "type": "Microsoft.Network/IpGroups",
  "etag": "75de7143-17e6-436c-adf4-d289d39695b7",
  "location": "westeurope"
}


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

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Network/ipGroups/myGroup?api-version=2021-05-01

Headers:
x-ms-client-request-id        : 0fbf22ea-6dd4-4bc5-bee1-d14a88d7fcc6
Accept-Language               : en-US

Body:



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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
ETag                          : "75de7143-17e6-436c-adf4-d289d39695b7"
Server                        : Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11996
x-ms-request-id               : b4bf7737-f827-464d-b36a-6a01deeb9132
x-ms-correlation-request-id   : b4bf7737-f827-464d-b36a-6a01deeb9132
x-ms-routing-request-id       : WESTEUROPE:20220908T101005Z:b4bf7737-f827-464d-b36a-6a01deeb9132
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Thu, 08 Sep 2022 10:10:05 GMT

Body:
{
  "properties": {
    "firewalls": [],
    "firewallPolicies": [],
    "ipAddresses": [
      "192.168.1.4",
      "192.168.1.5"
    ],
    "provisioningState": "Succeeded"
  },
  "id": "/subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Network/ipGroups/myGroup",
  "name": "myGroup",
  "type": "Microsoft.Network/IpGroups",
  "etag": "75de7143-17e6-436c-adf4-d289d39695b7",
  "location": "westeurope"
}



IpAddresses       : {192.168.1.4, 192.168.1.5}
Firewalls         : {}
ProvisioningState : Succeeded
ResourceGroupName : tstvpn
Location          : westeurope
ResourceGuid      :
Type              : Microsoft.Network/IpGroups
Tag               :
TagsTable         :
Name              : myGroup
Etag              : 75de7143-17e6-436c-adf4-d289d39695b7
Id                : /subscriptions/<subscriptionGUID>/resourceGroups/tstvpn/providers/Microsoft.Netwo
                    rk/ipGroups/myGroup

DEBUG: 12:10:05 - SetIpGroupsCommand end processing.

Environment data

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Microsoft Windows 10.0.22622
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

Get-Module Az.*

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.7.6                 Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefa…
Script     4.16.1                Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificat…
Script     5.6.0                 Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, G…
Script     1.0.1                 Az.Tools.Predictor                  {Disable-AzPredictor, Enable-AzPredictor, Open-Az…

Error output

N.A.

AndrevdG avatar Sep 08 '22 10:09 AndrevdG

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Sep 11 '22 12:09 ghost

@AndrevdG Apologies for the late reply. Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.

navba-MSFT avatar Dec 15 '22 02:12 navba-MSFT

@navba-MSFT No problem, I kinda forgot about this one.

Just rechecked and this is still happening with the current versions:

image
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.1
PSEdition                      Core
GitCommitId                    7.3.1
OS                             Microsoft Windows 10.0.22623
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.1
PSEdition                      Core
GitCommitId                    7.3.1
OS                             Microsoft Windows 10.0.22623
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

AndrevdG avatar Dec 15 '22 06:12 AndrevdG

@AndrevdG I will be creating a PR to fix this by eod today.

navba-MSFT avatar Dec 15 '22 07:12 navba-MSFT

@AndrevdG https://github.com/Azure/azure-powershell/pull/20473 PR has been created to address this issue. It is currently under review.

navba-MSFT avatar Dec 19 '22 08:12 navba-MSFT