Azure / Azure/azure-cli

az monitor autoscale rule create bugs and missing config fields

Open
#16,029 2 comments 0 reactions 2 assignees Claimed by @Jing-song View on GitHub
act-observability-squad feature-request Monitor p1_e1
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Overview
3 Issues Discovered.

1. **Autoscale direction when using 'to'**

https://github.com/Azure/azure-cli/blob/1fec5c4e721d2313e91c15a5ba542025759131d6/src/azure-cli/azure/cli/command_modules/monitor/util.py#L53

When you use --scale to X in az monitor autoscale rule create it sets the direction to None. This breaks the autoscale rule.

FYI - when creating the same 'to X' rule in the portal this populates the direction correctly with either an 'Increase' or 'Decrease' depending on the other rules in the profile.

![image](https://user-images.githubusercontent.com/4973075/100121027-8f47e300-2e70-11eb-8517-d2be6ad25225.png)

2. **dividePerInstance option and parameter is missing**
Additionally, the dividePerInstance field is missing from the autoscale rule cli template as seen here and is a critical missing component (it just seems to get defaulted to true at the moment which breaks my scaling rule needs!). This is populated and available when creating a rule in the portal:

![image](https://user-images.githubusercontent.com/4973075/100124735-eef3bd80-2e73-11eb-88fd-ed33b770ed0c.png)

https://github.com/Azure/azure-cli/blob/1fec5c4e721d2313e91c15a5ba542025759131d6/src/azure-cli/azure/cli/command_modules/monitor/operations/autoscale-parameters-template.json#L15

**These are both broken/missing features.**

[Referencing this previous issue:]
#https://github.com/Azure/azure-cli/issues/16027#issue-749669485

**_EDIT_** Found another issue
3. 'az monitor autoscale create' is not idempotent and will wipe all the existing profiles and rules if run again. This kind of makes it a bit useless to be honest as it would wipe profiles and other rules for the autoscale setting in other deployments each time. A check for if it already exists needs to be implemented to make it more in line with the other az commands and patterns.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.