AKS icon indicating copy to clipboard operation
AKS copied to clipboard

[BUG] Run Command does not work for email accounts that start with underscore

Open anielii opened this issue 9 months ago • 1 comments

Describe the bug The Run Command feature does not work for accounts with email addresses that begin with an underscore (e.g., "[email protected]"). The error message returned is as follows:

(KubernetesOperationError) Failed to run command in managed cluster due to kubernetes failure. details: Pod "command-d8a090f2f77741d58feb9382d5f09745" is invalid: metadata.labels: Invalid value: "_myemail_mail.com": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?') Code: KubernetesOperationError

The error exists both in az aks command invoke and Run Command in the portal.

To Reproduce Steps to reproduce the behavior:

  1. Create an email address that starts with an underscore.
  2. Run az aks command invoke --resource-group $rg --name $aksname --command "kubectl get pods -n kube-system" or any command using Run Command

Expected behavior The "Run Command" feature and "az aks command invoke" should allow commands to be executed from accounts with email addresses starting with an underscore (_).

Environment (please complete the following information):

  • CLI Version 2.70.0
  • Kubernetes version 1.30.9

anielii avatar Mar 21 '25 07:03 anielii

@anielii confirming that this happens because the Azure user account has an email (and user ID) that starts with an underscore?

sjwaight avatar May 21 '25 23:05 sjwaight

The error message is quite straightforward.

anielii avatar May 22 '25 03:05 anielii

It was more to confirm that the email address represents the username of the logged in user. I've been able to confirm that it does.

sjwaight avatar May 22 '25 03:05 sjwaight

A fix for this has been merged and will be released in the coming weeks. Please feel free to re-test in mid-June to confirm the fix. Thanks for reporting! I'm going to close the issue, but you can still comment. Feel free to tag me if any issues.

sjwaight avatar May 23 '25 01:05 sjwaight