Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.82k forks source link

Add-AzureRmAutoscaleSetting fails to identify cloudservice web role resource whose name has "." in it. #4779

Closed SunnyOswal closed 1 year ago

SunnyOswal commented 6 years ago

Cmdlet(s)

Add-AzureRmAutoscaleSetting

PowerShell Version

5.1.15063.608

Module Version

AzureRM.Insights 3.3.1

OS Version

10.0.15063.608

Description

Add-AzureRmAutoscaleSetting fails to identify cloudservice web role resource whose name has "." in it. But Get-AzureRmResource runs fine and gives resource details

Get-AzureRmResource -ResourceId "/subscriptions/<>/resourceGroups/Prod-UCM/providers/Microsoft.ClassicCompute/domainNames/Production-AZCEN-UcmApi/slots/Production/roles/UcmApi.Web").ResourceId

Debug Output (Removed subscription id and token info)

PS C:\windows\system32> Add-AzureRmAutoscaleSetting -Location "Central US" -Name "MyScaleVMSSSetting" -ResourceGroup $resourceGroup -TargetResourceId $resourceId -AutoscaleProfiles $profile1 DEBUG: 11:03:04 AM - AddAzureRmAutoscaleSettingCommand begin processing with ParameterSet 'Parameters for Add-AzureRmAutoscaleSetting cmdlet in the create semantics'. DEBUG: 11:03:04 AM - using account id 'v-suosw@<>'... DEBUG: [Common.Authentication]: Authenticating using Account: 'v-suosw@<>', environment: 'AzureCloud', tenant: '<>' DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:04: 69dffe2f-7fdc-44ca-aeec-3bd8460501d5 - AcquireTokenHandlerBase: === Token Acquisition started: Authority: https://login.microsoftonline.com/<>/ Resource: https://management.core.windows.net/ ClientId: 1950a258-227b-4e31-a9cf-717495945fc2 CacheType: Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache (1 items) Authentication Target: User

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:04: - TokenCache: Deserialized 1 items to token cache.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 10/13/2017 03:03:04: 69dffe2f-7fdc-44ca-aeec-3bd8460501d5 - TokenCache: Looking up cache for a token...

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:04: 69dffe2f-7fdc-44ca-aeec-3bd8460501d5 - TokenCache: An item matching the requested resource was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 10/13/2017 03:03:04: 69dffe2f-7fdc-44ca-aeec-3bd8460501d5 - TokenCache: An expired or near expiry token was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:04: 69dffe2f-7fdc-44ca-aeec-3bd8460501d5 - TokenCache: A matching item (access token or refresh token or both) was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 10/13/2017 03:03:04: 69dffe2f-7fdc-44ca-aeec-3bd8460501d5 - d__11: Refreshing access token...

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 10/13/2017 03:03:05: 69dffe2f-7fdc-44ca-aeec-3bd8460501d5 - TokenCache: Storing token in the cache...

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 10/13/2017 03:03:05: 69dffe2f-7fdc-44ca-aeec-3bd8460501d5 - TokenCache: An item was stored in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:05: 69dffe2f-7fdc-44ca-aeec-3bd8460501d5 - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned: Access Token Hash: <> Refresh Token Hash: <> Expiration Time: 10/13/2017 04:03:05 +00:00 User Hash: <>

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:05: - TokenCache: Serializing token cache with 1 items.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:05: <> - AcquireTokenHandlerBase: === Token Acquisition started: Authority: https://login.microsoftonline.com/<>/ Resource: https://management.core.windows.net/ ClientId: 1950a258-227b-4e31-a9cf-717495945fc2 CacheType: Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache (1 items) Authentication Target: User

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:05: - TokenCache: Deserialized 1 items to token cache.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 10/13/2017 03:03:05: <> - TokenCache: Looking up cache for a token...

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:05: <> - TokenCache: An item matching the requested resource was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 10/13/2017 03:03:05: <> - TokenCache: 59.998946515 minutes left until token in cache expires

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:05: <> - TokenCache: A matching item (access token or refresh token or both) was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 10/13/2017 03:03:05: <> - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned: Access Token Hash: <> Refresh Token Hash: <> Expiration Time: 10/13/2017 04:03:05 +00:00 User Hash: <>

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

HTTP Method: PUT

Absolute Uri: https://management.azure.com/subscriptions/<>/resourcegroups/Prod-UCM/providers/microsoft.insights/autoscalesettings/MyScaleVMSSSetting?api-version= 2015-04-01

Headers: x-ms-client-request-id : b440e911-0afe-4e46-b56d-48049a3cbc73 accept-language : en-US

Body: { "properties": { "profiles": [ { "name": "4", "capacity": { "minimum": "4", "maximum": "6", "default": "4" }, "rules": [ { "metricTrigger": { "metricName": "Percentage CPU", "metricResourceUri": "/subscriptions/<>/resourceGroups/Prod-UCM/providers/Microsoft.ClassicCompute/domainNames/Production-AZCEN-UcmApi ", "timeGrain": "PT1M", "statistic": "Average", "timeWindow": "PT10M", "timeAggregation": "Average", "operator": "GreaterThan", "threshold": 70.0 }, "scaleAction": { "direction": "Increase", "type": "ChangeCount", "value": "1", "cooldown": "PT10M" } }, { "metricTrigger": { "metricName": "Percentage CPU", "metricResourceUri": "/subscriptions/<>/resourceGroups/Prod-UCM/providers/Microsoft.ClassicCompute/domainNames/Production-AZCEN-UcmApi ", "timeGrain": "PT1M", "statistic": "Average", "timeWindow": "PT10M", "timeAggregation": "Average", "operator": "LessThan", "threshold": 70.0 }, "scaleAction": { "direction": "Decrease", "type": "ChangeCount", "value": "1", "cooldown": "PT10M" } } ] } ], "enabled": true, "targetResourceUri": "/subscriptions/<>/resourceGroups/Prod-UCM/providers/Microsoft.ClassicCompute/domainNames/Production-AZCEN-UcmApi/slots/Pro duction/roles/UcmApi.Web" }, "location": "Central US", "tags": {} }

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

Status Code: BadRequest

Headers: Pragma : no-cache Strict-Transport-Security : max-age=31536000; includeSubDomains x-ms-request-id : 00000000-0000-0000-0000-000000000000 x-ms-ratelimit-remaining-subscription-writes: 1199 x-ms-correlation-request-id : 43a98ce1-894a-4ffe-b0f5-d4d352f5ec46 x-ms-routing-request-id : SOUTHEASTASIA:20171013T030316Z:43a98ce1-894a-4ffe-b0f5-d4d352f5ec46 Cache-Control : no-cache Date : Fri, 13 Oct 2017 03:03:15 GMT Server : Microsoft-IIS/8.5

Body: { "code": "InvalidArgument", "message": "The property 'resourceId' has an invalid value." }

Add-AzureRmAutoscaleSetting : Exception type: ErrorResponseException, Message: The property 'resourceId' has an invalid value., Code: InvalidArgument, Status code:BadRequest, Reason phrase: Bad Request At line:1 char:1

DEBUG: AzureQoSEvent: CommandName - Add-AzureRmAutoscaleSetting; IsSuccess - False; Duration - 00:00:11.9589758; Exception - System.Management.Automation.PSInvalidOperationException: Exception type: ErrorResponseException, Message: The property 'resourceId' has an invalid value., Code: InvalidArgument, Status code:BadRequest, Reason phrase: Bad Request ---> Micr osoft.Azure.Management.Monitor.Management.Models.ErrorResponseException: Operation returned an invalid status code 'BadRequest' at Microsoft.Azure.Management.Monitor.Management.AutoscaleSettingsOperations.d__6.MoveNext() --- End of inner exception stack trace --- at Microsoft.Azure.Commands.Insights.MonitorCmdletBase.ExecuteCmdlet() at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord(); DEBUG: Finish sending metric. DEBUG: 11:03:17 AM - AddAzureRmAutoscaleSettingCommand end processing. DEBUG: 11:03:17 AM - AddAzureRmAutoscaleSettingCommand end processing.

Script/Steps for Reproduction

1.) Create Cloudservice (classic) having web role with the name having a "." e.g UcmApi.Web 2.) AddAzureRmAutoscaleSetting cmdlet fails in identifying resource. error: Add-AzureRmAutoscaleSetting : Exception type: ErrorResponseException, Message: The property 'resourceId' has an invalid value., Code: InvalidArgument, Status code:BadRequest, Reason phrase: Bad Request

markcowl commented 6 years ago

@aspaan @ahmedelnably Can one of you please take a look?

SunnyOswal commented 6 years ago

Any update ?

aspaan commented 6 years ago

I am not on Azure Powershell project anymore, please contact @ahmedelnably or Sisira for anymore issues

SunnyOswal commented 6 years ago

@ahmedelnably @markcowl Is anybody looking into this ?

panchagnula commented 6 years ago

@ahmedelnably can you look at this - i believe this should be assigned to the Insights service, but given this is an year old now - i might be missing some context here

panchagnula commented 6 years ago

@sphibbs , this is not a websites command, i had assigned to @ahmedelnably 14 days ago to follow up & find the right owner. Thank you.

ahmedelnably commented 6 years ago

@sphibbs as @panchagnula said this is not related to App Service, removing the label, and the assignment.

Relabeling it to Resource Manager

maddieclayton commented 6 years ago

@gucalder @micongjie Can you take a look at this issue?

RakeshMohanMSFT commented 1 year ago

Classic cloud service is deprecated, if you still need help. Please reopen this