Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-AzResource changes Tag Key case for "Microsoft.Web/sites" #7678

Closed
LukeDearden opened this issue Oct 26, 2018 · 5 comments
Closed

Set-AzResource changes Tag Key case for "Microsoft.Web/sites" #7678

LukeDearden opened this issue Oct 26, 2018 · 5 comments
Assignees
Milestone

Comments

@LukeDearden
Copy link

LukeDearden commented Oct 26, 2018

This is fine in the AzureRM Module but when using Az and Enable-AzureRmAlias it fudges the case

$tags = @{"UpperCaseKey" = "UpperCaseValue"}
Set-AzResource -ResourceGroupName ldtesting667 -ResourceName ldtesting667 -ResourceType "Microsoft.Web/sites" -Tag $tags -Force

$tags = (Get-AzResource -ResourceGroupName ldtesting667 -Name ldtesting667 -ResourceType "Microsoft.Web/sites").Tags

Key          Value
---          -----
upperCaseKey UpperCaseValue

> Get-InstalledModule -Name Az

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
0.4.0      Az                                  PSGallery            Azure Resource Manager Module. Cmdlets to manage resources in Azure.  This module is compatible with PowerShell and PowerShell Core

Originally posted by @LukeDearden in https://github.com/Azure/azure-powershell/issue_comments#issuecomment-433368328

@markcowl
Copy link
Member

@LukeDearden Can you please provide the debug trace in this case (set $DebugPreference="Continue" before runnign the cmdlet)? This will help to pinpoint whether this case change occurs in the service or the client.

@cormacpayne @Tiano2017 Unless I am mistaken tags should be case-preserving

@LukeDearden
Copy link
Author

Redacted some GUID's

Set-AzResource -ResourceGroupName ldtesting667 -ResourceName ldtesting667 -ResourceType "Microsoft.Web/sites" -Tag $tags -Force
DEBUG: 6:13:28 AM - SetAzureResourceCmdlet begin processing with ParameterSet 'BySubscriptionLevel'.
DEBUG: 6:13:28 AM - using account id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', environment: 'AzureCloud', tenant: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', Endpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob',
ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthrity: 'True'
DEBUG: [Common.Authentication]: Renewing token using AppId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', AdalConfiguration with ADDomain: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', AdEndpoint: 'https://login.microsoftonline.com/', ClientId:
'1950a258-227b-4e31-a9cf-717495945fc2', RedirectUri: 'urn:ietf:wg:oauth:2.0:oob'
DEBUG: [Common.Authentication]: Received token with LoginType 'OrgId', Tenant: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', UserId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '10/29/2018 07:11:06 +00:00' Comparing to '10/29/2018 06:13:28 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:57:38.2124125'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PATCH

Absolute Uri:
https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ldtesting667/providers/Microsoft.Web/sites/ldtesting667?api-version=2018-02-01

Headers:
User-Agent                    : AzurePowershell/v6.9.0,PSVersion/v5.1.14393.2515
ParameterSetName              : BySubscriptionLevel
CommandName                   : Set-AzResource

Body:
{
  "tags": {
    "upperCaseKey": "UpperCaseValue"
  }
}

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

Status Code:
OK

Headers:
Pragma                        : no-cache
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-request-id               : fd98bd3e-f934-4424-a2d4-904eb9307603
x-ms-ratelimit-remaining-subscription-resource-requests: 498
x-ms-correlation-request-id   : 82c98b0a-e326-4687-962c-9311c9554231
x-ms-routing-request-id       : NORTHEUROPE:20181029T061332Z:82c98b0a-e326-4687-962c-9311c9554231
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Mon, 29 Oct 2018 06:13:32 GMT
ETag                          : "1D46F4E842C1240"
Server                        : Microsoft-IIS/10.0
X-AspNet-Version              : 4.0.30319
X-Powered-By                  : ASP.NET

Body:
{
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ldtesting667/providers/Microsoft.Web/sites/ldtesting667",
  "name": "ldtesting667",
  "type": "Microsoft.Web/sites",
  "kind": "app",
  "location": "North Europe",
  "tags": {
    "upperCaseKey": "UpperCaseValue"
  },
  "properties": {
    "name": "ldtesting667",
    "state": "Running",
    "hostNames": [
      "ldtesting667.xxxxxxxxx.xxx",
      "ldtesting667.azurewebsites.net"
    ],
    "webSpace": "northeuropewebspace",
    "selfLink": "https://waws-prod-db3-007.api.azurewebsites.windows.net:454/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/webspaces/northeuropewebspace/sites/ldtesting667",
    "repositorySiteName": "ldtesting667",
    "owner": null,
    "usageState": "Normal",
    "enabled": true,
    "adminEnabled": true,
    "enabledHostNames": [
      "ldtesting667.xxxxxxxxx.xxx",
      "ldtesting667.azurewebsites.net",
      "ldtesting667.scm.azurewebsites.net"
    ],
    "siteProperties": {
      "metadata": null,
      "properties": [
        {
          "name": "LinuxFxVersion",
          "value": ""
        },
        {
          "name": "WindowsFxVersion",
          "value": null
        }
      ],
      "appSettings": null
    },
    "availabilityState": "Normal",
    "sslCertificates": null,
    "csrs": [],
    "cers": null,
    "siteMode": null,
    "hostNameSslStates": [
      {
        "name": "ldtesting667.azurewebsites.net",
        "sslState": "Disabled",
        "ipBasedSslResult": null,
        "virtualIP": null,
        "thumbprint": null,
        "toUpdate": null,
        "toUpdateIpBasedSsl": null,
        "ipBasedSslState": "NotConfigured",
        "hostType": "Standard"
      },
      {
        "name": "ldtesting667.xxxxxxxxx.xxx",
        "sslState": "SniEnabled",
        "ipBasedSslResult": null,
        "virtualIP": null,
        "thumbprint": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "toUpdate": null,
        "toUpdateIpBasedSsl": null,
        "ipBasedSslState": "NotConfigured",
        "hostType": "Standard"
      },
      {
        "name": "ldtesting667.scm.azurewebsites.net",
        "sslState": "Disabled",
        "ipBasedSslResult": null,
        "virtualIP": null,
        "thumbprint": null,
        "toUpdate": null,
        "toUpdateIpBasedSsl": null,
        "ipBasedSslState": "NotConfigured",
        "hostType": "Repository"
      }
    ],
    "computeMode": null,
    "serverFarm": null,
    "serverFarmId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Default-Web-NorthEurope/providers/Microsoft.Web/serverfarms/Default1",
    "reserved": false,
    "isXenon": false,
    "lastModifiedTimeUtc": "2018-10-29T06:13:31.62",
    "storageRecoveryDefaultState": "Running",
    "contentAvailabilityState": "Normal",
    "runtimeAvailabilityState": "Normal",
    "siteConfig": null,
    "deploymentId": "ldtesting667",
    "trafficManagerHostNames": null,
    "sku": "Standard",
    "scmSiteAlsoStopped": false,
    "targetSwapSlot": null,
    "hostingEnvironment": null,
    "hostingEnvironmentProfile": null,
    "clientAffinityEnabled": true,
    "clientCertEnabled": false,
    "hostNamesDisabled": false,
    "domainVerificationIdentifiers": null,
    "kind": "app",
    "outboundIpAddresses": "191.235.176.126,191.235.176.213,191.235.176.215,191.235.176.55,40.113.3.108,40.113.6.242,40.113.3.92,40.113.5.253",
    "possibleOutboundIpAddresses": "191.235.176.126,191.235.176.213,191.235.176.215,191.235.176.55,40.113.3.108,40.113.6.242,40.113.3.92,40.113.5.253,191.235.176.126,191.235.176.213,191.235.176.215,191.235.176.55,40.113.3.108,40.113.6.242,40.113.3.92,40.113.5.253",
    "containerSize": 0,
    "dailyMemoryTimeQuota": 0,
    "suspendedTill": null,
    "siteDisabledReason": 0,
    "functionExecutionUnitsCache": null,
    "maxNumberOfWorkers": null,
    "homeStamp": "waws-prod-db3-007",
    "cloningInfo": null,
    "hostingEnvironmentId": null,
    "tags": {
      "upperCaseKey": "UpperCaseValue"
    },
    "resourceGroup": "ldtesting667",
    "defaultHostName": "ldtesting667.azurewebsites.net",
    "slotSwapStatus": null,
    "httpsOnly": false
  }
}

DEBUG: [Common.Authentication]: Authenticating using Account: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', environment: 'AzureCloud', tenant: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', Endpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob',
ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthrity: 'True'
DEBUG: [Common.Authentication]: Renewing token using AppId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', AdalConfiguration with ADDomain: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', AdEndpoint: 'https://login.microsoftonline.com/', ClientId:
'1950a258-227b-4e31-a9cf-717495945fc2', RedirectUri: 'urn:ietf:wg:oauth:2.0:oob'
DEBUG: [Common.Authentication]: Received token with LoginType 'OrgId', Tenant: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', UserId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'


Name              : ldtesting667
ResourceId        : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ldtesting667/providers/Microsoft.Web/sites/ldtesting667
ResourceName      : ldtesting667
ResourceType      : Microsoft.Web/sites
Kind              : app
ResourceGroupName : ldtesting667
Location          : North Europe
SubscriptionId    : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Tags              : {upperCaseKey}
Properties        : @{name=ldtesting667; state=Running; hostNames=System.Object[]; webSpace=northeuropewebspace;
                    selfLink=https://waws-prod-db3-007.api.azurewebsites.windows.net:454/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/webspaces/northeuropewebspace/sites/ldtesting667; repositorySiteName=ldtesting667; owner=; usageState=Normal; enabled=True;
                    adminEnabled=True; enabledHostNames=System.Object[]; siteProperties=; availabilityState=Normal; sslCertificates=; csrs=System.Object[]; cers=; siteMode=; hostNameSslStates=System.Object[]; computeMode=; serverFarm=;
                    serverFarmId=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Default-Web-NorthEurope/providers/Microsoft.Web/serverfarms/Default1; reserved=False; isXenon=False; lastModifiedTimeUtc=2018-10-29T06:13:31.62;
                    storageRecoveryDefaultState=Running; contentAvailabilityState=Normal; runtimeAvailabilityState=Normal; siteConfig=; deploymentId=ldtesting667; trafficManagerHostNames=; sku=Standard; scmSiteAlsoStopped=False; targetSwapSlot=; hostingEnvironment=;
                    hostingEnvironmentProfile=; clientAffinityEnabled=True; clientCertEnabled=False; hostNamesDisabled=False; domainVerificationIdentifiers=; kind=app;
                    outboundIpAddresses=191.235.176.126,191.235.176.213,191.235.176.215,191.235.176.55,40.113.3.108,40.113.6.242,40.113.3.92,40.113.5.253; possibleOutboundIpAddresses=191.235.176.126,191.235.176.213,191.235.176.215,191.235.176.55,40.113.3.108,40.113.6.24
                    2,40.113.3.92,40.113.5.253,191.235.176.126,191.235.176.213,191.235.176.215,191.235.176.55,40.113.3.108,40.113.6.242,40.113.3.92,40.113.5.253; containerSize=0; dailyMemoryTimeQuota=0; suspendedTill=; siteDisabledReason=0;
                    functionExecutionUnitsCache=; maxNumberOfWorkers=; homeStamp=waws-prod-db3-007; cloningInfo=; hostingEnvironmentId=; tags=; resourceGroup=ldtesting667; defaultHostName=ldtesting667.azurewebsites.net; slotSwapStatus=; httpsOnly=False}

DEBUG: 6:13:32 AM - SetAzureResourceCmdlet end processing.
DEBUG: 6:13:32 AM - SetAzureResourceCmdlet end processing.

@LukeDearden
Copy link
Author

@markcowl this is what was sent in

> $tags

Name                           Value
----                           -----
UpperCaseKey                   UpperCaseValue


PS C:\Users\FrendsRemoteAdmin> $tags|fl *


Name  : UpperCaseKey
Key   : UpperCaseKey
Value : UpperCaseValue

@maddieclayton
Copy link
Contributor

Confirmed, can repro in current module

PS C:\Users\maclayto> $tags = @{"UpperCaseKey" = "UpperCaseValue"}
PS C:\Users\maclayto> Set-AzResource -ResourceGroupName maddie-webapp -ResourceName maddie-webapp -ResourceType Microsoft.Web/sites -Tag $tags -Debug
DEBUG: 1:58:30 PM - SetAzureResourceCmdlet begin processing with ParameterSet 'BySubscriptionLevel'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): a
DEBUG: 1:58:31 PM - using account id 'maclayto@microsoft.com'...

Confirm
Are you sure you want to perform this action?
Performing the operation "Updating the resource..." on target
"/subscriptions/*****/resourceGroups/maddie-webapp/providers/Microsoft.Web/sites/maddie-
webapp".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): a

Confirm
Are you sure you want to update the following resource:
/subscriptions/********/resourceGroups/maddie-webapp/providers/Microsoft.Web/sites/maddie-w
ebapp
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PATCH

Absolute Uri:
https://management.azure.com/subscriptions/****/resourceGroups/maddie-webapp/providers/
Microsoft.Web/sites/maddie-webapp?api-version=2018-02-01

Headers:
User-Agent                    : AzurePowershell/v6.9.0,PSVersion/v5.1.17763.1
ParameterSetName              : BySubscriptionLevel
CommandName                   : Set-AzResource

Body:
{
  "tags": {
    "upperCaseKey": "UpperCaseValue"
  }
}

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

Status Code:
OK

Headers:
Pragma                        : no-cache
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-request-id               : 
x-ms-ratelimit-remaining-subscription-resource-requests: 499
x-ms-correlation-request-id   : 
x-ms-routing-request-id       : 
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Thu, 01 Nov 2018 20:58:37 GMT
ETag                          : 
Server                        : Microsoft-IIS/10.0
X-AspNet-Version              : 4.0.30319
X-Powered-By                  : ASP.NET

Body:
{
  "id":
"/subscriptions/***/resourceGroups/maddie-webapp/providers/Microsoft.Web/sites/maddie-
webapp",
  "name": "maddie-webapp",
  "type": "Microsoft.Web/sites",
  "kind": "app",
  "location": "West US",
  "tags": {
    "upperCaseKey": "UpperCaseValue"
  },
  "properties": {
    "name": "maddie-webapp",
    "state": "Running",
    "hostNames": [
      "maddie-webapp.azurewebsites.net"
    ],
    "webSpace": "cleanupservice-WestUSwebspace",
    "selfLink":
"https://waws-prod-bay-101.api.azurewebsites.windows.net:454/subscriptions/***/webspac
es/cleanupservice-WestUSwebspace/sites/maddie-webapp",
    "repositorySiteName": "maddie-webapp",
    "owner": null,
    "usageState": "Normal",
    "enabled": true,
    "adminEnabled": true,
    "enabledHostNames": [
      "maddie-webapp.azurewebsites.net",
      "maddie-webapp.scm.azurewebsites.net"
    ],
    "siteProperties": {
      "metadata": null,
      "properties": [
        {
          "name": "LinuxFxVersion",
          "value": ""
        },
        {
          "name": "WindowsFxVersion",
          "value": null
        }
      ],
      "appSettings": null
    },
    "availabilityState": "Normal",
    "sslCertificates": null,
    "csrs": [],
    "cers": null,
    "siteMode": null,
    "hostNameSslStates": [
      {
        "name": "maddie-webapp.azurewebsites.net",
        "sslState": "Disabled",
        "ipBasedSslResult": null,
        "virtualIP": null,
        "thumbprint": null,
        "toUpdate": null,
        "toUpdateIpBasedSsl": null,
        "ipBasedSslState": "NotConfigured",
        "hostType": "Standard"
      },
      {
        "name": "maddie-webapp.scm.azurewebsites.net",
        "sslState": "Disabled",
        "ipBasedSslResult": null,
        "virtualIP": null,
        "thumbprint": null,
        "toUpdate": null,
        "toUpdateIpBasedSsl": null,
        "ipBasedSslState": "NotConfigured",
        "hostType": "Repository"
      }
    ],
    "computeMode": null,
    "serverFarm": null,
    "serverFarmId":
"/subscriptions/***/resourceGroups/cleanupservice/providers/Microsoft.Web/serverfarms/
***",
    "reserved": false,
    "isXenon": false,
    "lastModifiedTimeUtc": "2018-11-01T20:58:37.6133333",
    "storageRecoveryDefaultState": "Running",
    "contentAvailabilityState": "Normal",
    "runtimeAvailabilityState": "Normal",
    "siteConfig": null,
    "deploymentId": "maddie-webapp",
    "trafficManagerHostNames": null,
    "sku": "Free",
    "scmSiteAlsoStopped": false,
    "targetSwapSlot": null,
    "hostingEnvironment": null,
    "hostingEnvironmentProfile": null,
    "clientAffinityEnabled": true,
    "clientCertEnabled": false,
    "hostNamesDisabled": false,
    "domainVerificationIdentifiers": null,
    "kind": "app",
    "outboundIpAddresses": 
    "possibleOutboundIpAddresses":
    "containerSize": 0,
    "dailyMemoryTimeQuota": 0,
    "suspendedTill": null,
    "siteDisabledReason": 0,
    "functionExecutionUnitsCache": null,
    "maxNumberOfWorkers": null,
    "homeStamp": "waws-prod-bay-101",
    "cloningInfo": null,
    "hostingEnvironmentId": null,
    "tags": {
      "upperCaseKey": "UpperCaseValue"
    },
    "resourceGroup": "maddie-webapp",
    "defaultHostName": "maddie-webapp.azurewebsites.net",
    "slotSwapStatus": null,
    "httpsOnly": false
  }
}
DEBUG: 1:58:38 PM - SetAzureResourceCmdlet end processing.
DEBUG: 1:58:38 PM - SetAzureResourceCmdlet end processing.

@maddieclayton maddieclayton removed their assignment Nov 1, 2018
@maddieclayton maddieclayton removed this from the 2018-11-06 milestone Nov 1, 2018
@markcowl markcowl self-assigned this Nov 14, 2018
markcowl added a commit to markcowl/azure-powershell that referenced this issue Nov 14, 2018
maddieclayton pushed a commit that referenced this issue Nov 14, 2018
Fix for #7678, #7703: preserve case in Tag keys
@markcowl markcowl added this to the 2018-11-20 milestone Nov 14, 2018
@markcowl
Copy link
Member

Fix in this commit: markcowl@f78806a

Filx will be released on 11/20

@mozehgir mozehgir added the ARM label Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants