Azure / Azure/azure-cli-extensions

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

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

Description

### 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.

```bash
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:
```bash
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_

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.