Azure / Azure/azure-cli-extensions

"az ml" commands ignore the "--subscription" global argument

Open
#516 2 comments 0 reactions 0 assignees View on GitHub
extension/ml Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

### Extension name (the extension in question)
Machine Learning CLI extension version 1.0.10

### Description of issue (in as much detail as possible)

-----

The Azure CLI provides all `az ml` commands with the `--subscription` global argument, which is visible in the help text. Unfortunately, `az ml` commands ignore this argument and use the subscription currently selected as default using `az account set --subscription`:

```
> az account set --subscription aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
> az ml workspace list
[]
> az ml workspace list -h
This command is from the following extension: azure-cli-ml

Command
az ml workspace list : List workspaces.

Arguments
--resource-group -g : Resource group name.

Global Arguments
--debug : Increase logging verbosity to show all debug logs.
--help -h : Show this help message and exit.
--output -o : Output format. Allowed values: json, jsonc, none, table, tsv, yaml.
Default: 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 ml workspace list --subscription bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
[]
> az account set --subscription bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
> az ml workspace list
[
{
"resourceGroup": "test-rg",
"subscriptionId": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
"workspaceName": "test-mlsw"
}
]
```

This is confusing to the user and makes scripts more complicated and less reliable (because they now rely on global state shared between separate shell windows).

To make matters even worse, `az ml datastore` commands define _their own_ `--subscription-id` argument.

It would be very helpful if all `az ml` commands respected the `--subscription` global argument.

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior with `az ml workspace list` and compare explicit `--subscription` values with the subscription selected by `az account set`. Trace the Machine Learning CLI extension command entry points, including `az ml datastore`, and verify that every `az ml` command uses the global subscription argument rather than shared account state or a separate `--subscription-id` option.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
cli, cloud, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.