Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
383 stars 1.24k forks source link

az connectedk8s enable-features doesn't check if custom-locations-oid input parameter is valid #7375

Open flecoqui opened 8 months ago

flecoqui commented 8 months ago

Describe the bug

It's an issue related to "az connectedk8s enable-features" Azure client extension azure client version: 2.58.0 running in an Ubuntu virtual machine in eastus2 region.

The command was used in a virtual machine hosting K3S cluster.

A script called the command line below, though the input parameter custom-locations-oid was incorrect (=4d5bfd0f-2428-4dcb-b8c7-9e439054b9a9), the command didn't raise any error like invalid GUID.

sudo -u azureuser az connectedk8s enable-features -n vmaio6989devcloudcorp -g rgaio6989devcloud --custom-locations-oid =4d5bfd0f-2428-4dcb-b8c7-9e439054b9a9 --features cluster-connect custom-locations
"Successsfully enabled features: ['cluster-connect', 'custom-locations'] for the Connected Cluster vmaio6989devcloudcorp"

Below the command and result with the correct GUID input:

sudo -u azureuser az connectedk8s enable-features -n vmaio6989devcloudcorp -g rgaio6989devcloud --custom-locations-oid **4d5bfd0f-2428-4dcb-b8c7-9e439054b9a9** --features cluster-connect custom-locations
"Successsfully enabled features: ['cluster-connect', 'custom-locations'] for the Connected Cluster vmaio6989devcloudcorp"

Actually, it seems this command 'az connectedk8s enable-features' accepts any string as input parameter without raising any error.

Related command

sudo -u azureuser az connectedk8s enable-features -n vmaio6989devcloudcorp -g rgaio6989devcloud --custom-locations-oid =4d5bfd0f-2428-4dcb-b8c7-9e439054b9a9 --features cluster-connect custom-locations

Errors

No error raised

Issue script & Debug output

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus This operation might take a while...

"Successsfully enabled features: ['cluster-connect', 'custom-locations'] for the Connected Cluster vmaio6989devcloudcorp"

Expected behavior

An error should be raised

Environment Summary

az --version azure-cli 2.58.0

core 2.58.0 telemetry 1.1.0

Extensions: azure-iot-ops 0.4.0b1 connectedk8s 1.6.6 customlocation 0.1.3 k8s-configuration 1.7.0 k8s-extension 1.6.1

Dependencies: msal 1.26.0 azure-mgmt-resource 23.1.0b2

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

Python (Linux) 3.11.7 (main, Feb 29 2024, 02:08:19) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

yonzhan commented 8 months ago

Thank you for opening this issue, we will look into it.