az alerts-management prometheus-rule-group

Note

This reference is part of the alertsmanagement extension for the Azure CLI (version 2.45.0 or higher). The extension will automatically install the first time you run an az alerts-management prometheus-rule-group command. Learn more about extensions.

Manage Prometheus Rule Group.

Commands

Name Description Type Status
az alerts-management prometheus-rule-group create

Create a Prometheus rule group definition.

Extension GA
az alerts-management prometheus-rule-group delete

Delete a Prometheus rule group definition.

Extension GA
az alerts-management prometheus-rule-group list

List Prometheus all rule group definitions in a subscription.

Extension GA
az alerts-management prometheus-rule-group show

Get a Prometheus rule group definition.

Extension GA
az alerts-management prometheus-rule-group update

Update a Prometheus rule group definition.

Extension GA

az alerts-management prometheus-rule-group create

Create a Prometheus rule group definition.

az alerts-management prometheus-rule-group create --name
                                                  --resource-group
                                                  --rules
                                                  --scopes
                                                  [--cluster-name]
                                                  [--description]
                                                  [--enabled {0, 1, f, false, n, no, t, true, y, yes}]
                                                  [--interval]
                                                  [--location]
                                                  [--tags]

Examples

Create a Prometheus rule group definition.

az alerts-management prometheus-rule-group create -n TestPrometheusRuleGroup -g TestResourceGroup -l westus --enabled --description "test" --interval PT10M --scopes "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/testrg/providers/microsoft.monitor/accounts/testaccount" --rules [{"record":"test","expression":"test","labels":{"team":"prod"}},{"alert":"Billing_Processing_Very_Slow","expression":"test","enabled":"true","severity":2,"for":"PT5M","labels":{"team":"prod"},"annotations":{"annotationName1":"annotationValue1"},"resolveConfiguration":{"autoResolved":"true","timeToResolve":"PT10M"},"actions":[{"actionGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/microsoft.insights/actionGroups/test-action-group-name1","actionProperties":{"key11":"value11","key12":"value12"}},{"actionGroupId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/microsoft.insights/actionGroups/test-action-group-name2","actionProperties":{"key21":"value21","key22":"value22"}}]}]

Required Parameters

--name -n

The name of the rule group.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--rules

Defines the rules in the Prometheus rule group. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--scopes

Target Azure Monitor workspaces resource ids. This api-version is currently limited to creating with one scope. This may change in future. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Optional Parameters

--cluster-name

Apply rule to data from a specific cluster.

--description

Rule group description.

--enabled

Enable/disable rule group.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--interval

The interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and 15 minutes.

--location -l

The geo-location where the resource lives When not specified, the location of the resource group will be used.

--tags

Resource tags. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az alerts-management prometheus-rule-group delete

Delete a Prometheus rule group definition.

az alerts-management prometheus-rule-group delete [--ids]
                                                  [--name]
                                                  [--resource-group]
                                                  [--subscription]

Examples

Delete a Prometheus rule group definition.

az alerts-management prometheus-rule-group delete -n TestPrometheusRuleGroup -g MyResourceGroup

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

The name of the rule group.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az alerts-management prometheus-rule-group list

List Prometheus all rule group definitions in a subscription.

az alerts-management prometheus-rule-group list [--resource-group]

Examples

List a Prometheus rule group definition.

az alerts-management prometheus-rule-group list -g MyResourceGroup

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az alerts-management prometheus-rule-group show

Get a Prometheus rule group definition.

az alerts-management prometheus-rule-group show [--ids]
                                                [--name]
                                                [--resource-group]
                                                [--subscription]

Examples

Show a Prometheus rule group definition.

az alerts-management prometheus-rule-group show -n TestPrometheusRuleGroup -g MyResourceGroup

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

The name of the rule group.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az alerts-management prometheus-rule-group update

Update a Prometheus rule group definition.

az alerts-management prometheus-rule-group update [--add]
                                                  [--cluster-name]
                                                  [--description]
                                                  [--enabled {0, 1, f, false, n, no, t, true, y, yes}]
                                                  [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                                                  [--ids]
                                                  [--interval]
                                                  [--name]
                                                  [--remove]
                                                  [--resource-group]
                                                  [--rules]
                                                  [--scopes]
                                                  [--set]
                                                  [--subscription]
                                                  [--tags]

Examples

Update a Prometheus rule group definition.

az alerts-management prometheus-rule-group update -n TestPrometheusRuleGroup -g MyResourceGroup --tags key=value

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--cluster-name

Apply rule to data from a specific cluster.

--description

Rule group description.

--enabled

Enable/disable rule group.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--interval

The interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and 15 minutes.

--name -n

The name of the rule group.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--rules

Defines the rules in the Prometheus rule group. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--scopes

Target Azure Monitor workspaces resource ids. This api-version is currently limited to creating with one scope. This may change in future. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Resource tags. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.