Skip to content

Set-AzureRmResource sets tags in lowercase for Microsoft.Sql resources #5098

Open
@rwaal

Description

@rwaal

Cmdlet(s)

Set-AzureRmResource

PowerShell Version

5.1.16299.64

Module Version

4.4.0

OS Version

10.0.16299.64

Description

When I use the Set-AzureRmResource cmdlet to configure tags on Microsoft.Sql resources (eg SQL database) in Azure, the tag names are always set in lowercase. For example, when executing the command below, the tag name 'MyTag' will actually be configured in Azure as 'myTag'.

Set-AzureRmResource -ResourceId $resourceId -Tag @{ MyTag="test" }

Note the first character of the configured tag is lowercase instead of uppercase. This behaviour only occurs on Microsoft.Sql resources, as far as I have seen.

Debug Output

DEBUG: [Common.Authentication]: Authenticating using Account: '#HiddenForGithubIssue#', environment: 'AzureCloud', tenant: '#HiddenForGithubIssue#'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:32: - TokenCache: Serializing token cache with 1 items.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:32: - TokenCache: Serializing token cache with 1 items.
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: '#HiddenForGithubIssue#', Endpoint: 'https://login.microsoftonline.com/', ClientId: '#HiddenForGithubIssue#',
ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthrity: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/#HiddenForGithubIssue#/', CorrelationId: '00000000-0000-0000-0000-000000000000',
ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: '#HiddenForGithubIssue#', AdEndpoint: 'https://login.microsoftonline.com/', ClientId:
'#HiddenForGithubIssue#', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:32: #HiddenForGithubIssue# - AcquireTokenHandlerBase: === Token Acquisition started:
Authority: https://login.microsoftonline.com/#HiddenForGithubIssue#/
Resource: https://management.core.windows.net/
ClientId: #HiddenForGithubIssue#
CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (1 items)
Authentication Target: User

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 12/07/2017 12:07:32: #HiddenForGithubIssue# - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:32: #HiddenForGithubIssue# - TokenCache: An item matching the requested resource was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 12/07/2017 12:07:32: #HiddenForGithubIssue# - TokenCache: 34.9416720633333 minutes left until token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:32: #HiddenForGithubIssue# - TokenCache: A matching item (access token or refresh token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:32: #HiddenForGithubIssue# - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
Access Token Hash: #HiddenForGithubIssue#
Refresh Token Hash: #HiddenForGithubIssue#
Expiration Time: 12/07/2017 12:42:29 +00:00
User Hash: #HiddenForGithubIssue#

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:32: - TokenCache: Serializing token cache with 1 items.
DEBUG: [Common.Authentication]: Received token with LoginType 'LiveId', Tenant: '#HiddenForGithubIssue#', UserId: '#HiddenForGithubIssue#'
DEBUG: [Common.Authentication]: Renewing Token with Type: 'Bearer', Expiry: '12/07/2017 12:42:29 +00:00', MultipleResource? 'True', Tenant: '#HiddenForGithubIssue#', UserId: '#HiddenForGithubIssue#'
DEBUG: [Common.Authentication]: User info for token DisplayId: '#HiddenForGithubIssue#', Name: Richard Waal, IdProvider: 'https://sts.windows.net/#HiddenForGithubIssue#/', Uid:
'3fd82f80-909e-4e93-809f-700ab2f9cc19'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '12/07/2017 12:42:29 +00:00' Comparing to '12/07/2017 12:07:32 +00:00' With threshold '00:05:00', calculated time until token expiry:
'00:34:56.4993006'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PATCH

Absolute Uri:
https://management.azure.com/subscriptions/#HiddenForGithubIssue#/resourceGroups/RichardsSQlTest/providers/Microsoft.Sql/servers/richardssqltest?api-version=2014-04-01

Headers:
User-Agent : PSVersion/v5.1.16299.64,AzurePowershell/v4.4.0
ParameterSetName : The resource Id.
CommandName : Set-AzureRmResource

Body:
{
"tags": {
"MyTag": "test"
}
}

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

Status Code:
OK

Headers:
x-ms-request-id : cfcbeee0-d544-4c88-a678-cd7cf92be61e
X-Content-Type-Options : nosniff
Preference-Applied : return-content
DataServiceVersion : 3.0;
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1198
x-ms-correlation-request-id : 4673077f-f3bb-4f97-aa07-cc60462bef3b
x-ms-routing-request-id : WESTEUROPE:20171207T120742Z:4673077f-f3bb-4f97-aa07-cc60462bef3b
Cache-Control : no-store, no-cache
Date : Thu, 07 Dec 2017 12:07:41 GMT
Server : Microsoft-HTTPAPI/2.0

Body:
{
"tags": {
"MyTag": "test"
},
"id": "/subscriptions/#HiddenForGithubIssue#/resourceGroups/RichardsSQlTest/providers/Microsoft.Sql/servers/richardssqltest",
"name": "richardssqltest",
"type": "Microsoft.Sql/servers",
"location": "West Europe",
"kind": "v12.0",
"properties": {
"fullyQualifiedDomainName": "richardssqltest.database.windows.net",
"administratorLogin": "#HiddenForGithubIssue#",
"administratorLoginPassword": null,
"externalAdministratorLogin": null,
"externalAdministratorSid": null,
"version": "12.0",
"state": "Ready"
}
}

DEBUG: [Common.Authentication]: Authenticating using Account: '#HiddenForGithubIssue#', environment: 'AzureCloud', tenant: '#HiddenForGithubIssue#'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:40: - TokenCache: Serializing token cache with 1 items.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:40: - TokenCache: Serializing token cache with 1 items.
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: '#HiddenForGithubIssue#', Endpoint: 'https://login.microsoftonline.com/', ClientId: '#HiddenForGithubIssue#',
ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthrity: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/#HiddenForGithubIssue#/', CorrelationId: '00000000-0000-0000-0000-000000000000',
ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: '#HiddenForGithubIssue#', AdEndpoint: 'https://login.microsoftonline.com/', ClientId:
'#HiddenForGithubIssue#', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:40: #HiddenForGithubIssue# - AcquireTokenHandlerBase: === Token Acquisition started:
Authority: https://login.microsoftonline.com/#HiddenForGithubIssue#/
Resource: https://management.core.windows.net/
ClientId: #HiddenForGithubIssue#
CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (1 items)
Authentication Target: User

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 12/07/2017 12:07:40: #HiddenForGithubIssue# - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:40: #HiddenForGithubIssue# - TokenCache: An item matching the requested resource was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 12/07/2017 12:07:40: #HiddenForGithubIssue# - TokenCache: 34.8093823066667 minutes left until token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:40: #HiddenForGithubIssue# - TokenCache: A matching item (access token or refresh token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:40: #HiddenForGithubIssue# - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
Access Token Hash: #HiddenForGithubIssue#
Refresh Token Hash: #HiddenForGithubIssue#
Expiration Time: 12/07/2017 12:42:29 +00:00
User Hash: #HiddenForGithubIssue#

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 12/07/2017 12:07:40: - TokenCache: Serializing token cache with 1 items.
DEBUG: [Common.Authentication]: Received token with LoginType 'LiveId', Tenant: '#HiddenForGithubIssue#', UserId: '#HiddenForGithubIssue#'

Script/Steps for Reproduction

Simply set a tag on a Sql resource in Azure using the Set-AzureRmResource cmdlet, for example a Azure Sql database. In my case the first character of the tag name will always be lowercase.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions