Azure / Azure/azure-cli-extensions

[NetworkCloud] metricsconfiguration create leaves failed resource when extended location is incompatible

Open
#10,253 1 comment 0 reactions 0 assignees View on GitHub
Auto-Assign bug Connected Kubernetes customer-reported Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

### Describe the bug

az networkcloud cluster metricsconfiguration create does not validate that --extended-location belongs to the target cluster before creating the metrics configuration resource.

When a Cluster Manager custom location is supplied instead of the cluster custom location, resource creation succeeds, but the subsequent extension association fails. This leaves a failed metrics configuration with no valid extension association and requires manual cleanup before retrying.

### Related command

'az networkcloud cluster metricsconfiguration create \
--subscription "" \
--resource-group "" \
--cluster-name "" \
--location "" \
--extended-location \
name="" \
type="CustomLocation" \
--collection-interval 5 \
--enabled-metrics "xxx"'

### Errors

(MissingAzureKubernetesMapping) The cluster extension '/subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Kubernetes/connectedClusters/XXX/providers/Microsoft.KubernetesConfiguration/extensions/nc-cluster-extension' does not support resource type 'Microsoft.NetworkCloud/clusters/metricsConfigurations'. The currently enabled resource types are clusters,clusters/ContinueUpdateVersion,clusters/Deploy,clusters/Inspect,clusters/RotateCredential,clusters/ScanRuntime,clusters/UpdateVersion,virtualMachines/consoles'. Please ensure the 'Microsoft.NetworkCloud' cluster extension version metadata file supports the resource type. [ClusterExtensionVersion='XXX'] [CorrelationId='XXX']

### Issue script & Debug output

N/A

### Expected behavior

The CLI should validate the extended location before creating the resource and reject an incompatible custom location without leaving any resource behind. Alternatively, creation and extension association should behave atomically and roll back the resource when association fails.

### Environment Summary

azure-cli 2.84.0 *

core 2.84.0 *
telemetry 1.1.0

Extensions:
aks-preview 18.0.0b24
azure-devops 1.0.2
connectedk8s 1.11.0
connectedmachine 1.0.0
customlocation 0.1.4
k8s-extension 1.7.0
managednetworkfabric 8.0.0b7
networkcloud 3.0.0
resource-graph 2.1.1
ssh 2.0.6
stack-hci-vm 1.11.6

Dependencies:
msal 1.35.0b1
azure-mgmt-resource 24.0.0

Python location '/opt/az/bin/python3'
Config directory '/home/smithl/.azure'
Extensions directory '/home/smithl/.azure/cliextensions'

Python (Linux) 3.13.11 (main, Feb 25 2026, 02:29:34) [GCC 13.3.0]

Legal docs and information: aka.ms/AzureCliLegal

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `az networkcloud cluster metricsconfiguration create` command with an incompatible `--extended-location`, then inspect the networkcloud extension's metricsconfiguration create flow. Done means the command rejects an incompatible custom location before creating a resource, or removes the resource when extension association fails; add coverage for the failed case if the extension has matching tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.