Open vinaydam opened 7 years ago
@asheniam @gucalder Can one of you take a look?
The engineering team looked at this and the existing metric alerts backend (which supports Add-AzureRmMetricAlert cmdlet) does not support any of the new metrics added by Websites team such as FunctionExecutionCount. We are currently working on a new v2 release of metric alerts all up (called near real time metrics) which will cover these new metrics. We apologize for the confusion.
Unfortunately there isn't any update on this one. The engineering team is working on the v2 API/backend of metric alerts with target GA in the next few months. The existing Add-AzureRmMetricAlertRule cmdlet is for v1 metric alerts only -- this will eventually be deprecated in the future after we add corresponding cmdlets for v2.
@asheniam Hey Andy, is this issue still active, or can we close it?
@asheniam - is this still an issue? Add-AzureRmMetricAlertRule : Exception type: ErrorResponseException, Message: The metric with namespace '' and name 'CPU Time' is not supported for this resource id, If possible can you point me to the right documentation for the new metric alert creation
@asheniam Is there an update on this?
is there any update on this >? @asheniam @bsiegel
Hi folks,
The cmdlets being talked about in this issue are for classic metric alerts. Cmdlets for v2 alerts are in the works. These should be available by End of march/early April.
@cormacpayne - you can close the issue.
Regards, Snehith
Cmdlet(s)
Add-AzureRmMetricAlertRule
PowerShell Version
5.1.16299.19
Module Version
4.0.0
OS Version
10.0.16299.19
Description
When I try to add the "FunctionExecutionCount" or "Http5xx" metrics to a function app using the Add-AzureRmMetricAlertRule, it fails citing the error "Add-AzureRmMetricAlertRule : Exception type: ErrorResponseException, Message: The metric with namespace '' and name 'FunctionExecutionCount' is not supported for this resource id". The same behavior is observed for function apps with an App Service Plan and a Consumption Plan.
Debug Output
DEBUG: 4:46:55 PM - AddAzureRmMetricAlertRuleCommand begin processing with ParameterSet '__AllParameterSets'. DEBUG: 4:46:55 PM - using account id 'vinaydami@outlook.com'... WARNING: [Add-AzureRmMetricAlertRule] Parameter name change: The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names. DEBUG: [Common.Authentication]: Authenticating using Account: 'vinaydami@outlook.com', environment: 'AzureCloud', tenant: '5ed1d584-3cdd-4f8b-87b5-515a23 e7e65e' DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: 16a2e83f-93d5-4471-a9b7-f34e810934ef - AcquireTokenHandlerBase: === Token Acquisition started: Authority: https://login.microsoftonline.com/5ed1d584-3cdd-4f8b-87b5-515a23e7e65e/ Resource: https://management.core.windows.net/ ClientId: 1950a258-227b-4e31-a9cf-717495945fc2 CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (6 items) Authentication Target: User
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 11/14/2017 11:16:55: 16a2e83f-93d5-4471-a9b7-f34e810934ef - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: 16a2e83f-93d5-4471-a9b7-f34e810934ef - TokenCache: An item matching the requested resource was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 11/14/2017 11:16:55: 16a2e83f-93d5-4471-a9b7-f34e810934ef - TokenCache: 29.7242895766667 minutes left until token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: 16a2e83f-93d5-4471-a9b7-f34e810934ef - TokenCache: A matching item (access token or refresh token or both) was found in the c ache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: 16a2e83f-93d5-4471-a9b7-f34e810934ef - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned: Access Token Hash: vqZ9QV1qyjNrjiISc/Ym8W7r3RSLJpKelruP+3vwbTg= Refresh Token Hash: VDR4u6C0ZYqv1GBz/FdeF9w0pTZ35mMuhTOIrf9s/Sg= Expiration Time: 11/14/2017 11:46:38 +00:00 User Hash: 4uMjdux6PlbHohqQSPfTCHKRPTSuusBeoflGpyYQ1ps=
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: - TokenCache: Serializing token cache with 6 items.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: 6fbd5187-9561-4284-9b57-1c3b5512956d - AcquireTokenHandlerBase: === Token Acquisition started: Authority: https://login.microsoftonline.com/5ed1d584-3cdd-4f8b-87b5-515a23e7e65e/ Resource: https://management.core.windows.net/ ClientId: 1950a258-227b-4e31-a9cf-717495945fc2 CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (6 items) Authentication Target: User
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 11/14/2017 11:16:55: 6fbd5187-9561-4284-9b57-1c3b5512956d - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: 6fbd5187-9561-4284-9b57-1c3b5512956d - TokenCache: An item matching the requested resource was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : DEBUG: 11/14/2017 11:16:55: 6fbd5187-9561-4284-9b57-1c3b5512956d - TokenCache: 29.7241557933333 minutes left until token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: 6fbd5187-9561-4284-9b57-1c3b5512956d - TokenCache: A matching item (access token or refresh token or both) was found in the c ache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: 6fbd5187-9561-4284-9b57-1c3b5512956d - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned: Access Token Hash: vqZ9QV1qyjNrjiISc/Ym8W7r3RSLJpKelruP+3vwbTg= Refresh Token Hash: VDR4u6C0ZYqv1GBz/FdeF9w0pTZ35mMuhTOIrf9s/Sg= Expiration Time: 11/14/2017 11:46:38 +00:00 User Hash: 4uMjdux6PlbHohqQSPfTCHKRPTSuusBeoflGpyYQ1ps=
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : DEBUG: 11/14/2017 11:16:55: - TokenCache: Serializing token cache with 6 items.
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method: PUT
Absolute Uri: https://management.azure.com/subscriptions/8d6baaa6-0ec4-49fd-acfa-55c3194e32dd/resourcegroups/functions/providers/microsoft.insights/alertrules/functest ?api-version=2016-03-01
Headers: x-ms-client-request-id : f11fbc53-a7a8-4567-ba09-cc123809fe9e accept-language : en-US
Body: { "properties": { "name": "functest", "description": "This metric alert rule was created from Powershell version: 4.0.0", "isEnabled": true, "condition": { "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", "operator": "GreaterThan", "threshold": 100.0, "windowSize": "PT5M", "timeAggregation": "Total", "dataSource": { "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", "metricName": "FunctionExecutionCount", "resourceUri": "/subscriptions/8d6baaa6-0ec4-49fd-acfa-55c3194e32dd/resourceGroups/functions/providers/Microsoft.Web/sites/funcappstdplan" } } }, "location": "westus", "tags": { "$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary,Microsoft.WindowsAzure.Management.Common.Storage", "hidden-link:/subscriptions/8d6baaa6-0ec4-49fd-acfa-55c3194e32dd/resourceGroups/functions/providers/Microsoft.Web/sites/funcappstdplan": "Resource" } }
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: 1195 x-ms-correlation-request-id : 0a9e5112-d5f7-43b6-b346-8d82ca7c83ba x-ms-routing-request-id : SOUTHINDIA:20171114T111700Z:0a9e5112-d5f7-43b6-b346-8d82ca7c83ba Cache-Control : no-cache Date : Tue, 14 Nov 2017 11:16:59 GMT Server : Microsoft-IIS/8.5
Body: { "code": "UnsupportedMetric", "message": "The metric with namespace '' and name 'FunctionExecutionCount' is not supported for this resource id '/subscriptions/8d6baaa6-0ec4-49fd-acf a-55c3194e32dd/resourceGroups/functions/providers/Microsoft.Web/sites/funcappstdplan'." }
Add-AzureRmMetricAlertRule : Exception type: ErrorResponseException, Message: The metric with namespace '' and name 'FunctionExecutionCount' is not supported for this resource id '/subscriptions/8d6baaa6-0ec4-49fd-acfa-55c3194e32dd/resourceGroups/functions/providers/Microsoft.Web/sites/funcappstdplan'., Code: UnsupportedMetric, Status code:BadRequest, Reason phrase: Bad Request At line:1 char:1
DEBUG: AzureQoSEvent: CommandName - Add-AzureRmMetricAlertRule; IsSuccess - False; Duration - 00:00:05.1417806; Exception - System.Management.Automation. PSInvalidOperationException: Exception type: ErrorResponseException, Message: The metric with namespace '' and name 'FunctionExecutionCount' is not suppo rted for this resource id '/subscriptions/8d6baaa6-0ec4-49fd-acfa-55c3194e32dd/resourceGroups/functions/providers/Microsoft.Web/sites/funcappstdplan'., C ode: UnsupportedMetric, Status code:BadRequest, Reason phrase: Bad Request ---> Microsoft.Azure.Management.Monitor.Management.Models.ErrorResponseExcepti on: Operation returned an invalid status code 'BadRequest' at Microsoft.Azure.Management.Monitor.Management.AlertRulesOperations.d__5.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: 4:47:00 PM - AddAzureRmMetricAlertRuleCommand end processing.
DEBUG: 4:47:00 PM - AddAzureRmMetricAlertRuleCommand end processing.
Script/Steps for Reproduction
1) Create a function app with a Standard App service plan or a consumption plan 2) Execute the following powershell command: Add-AzureRmMetricAlertRule -ResourceGroup functions -TargetResourceId "/subscriptions/8d6baaa6-0ec4-49fd-acfa-55c3194e32dd/resourceGroups/functions/providers/Microsoft.Web/sites/funcappstdplan" -MetricName "FunctionExecutionCount" -Name "functest" -WindowSize 00:05:00 -TimeAggregationOperator Total -Operator GreaterThan -Threshold "100" -Location "westus"