Skip to content

fix: resolves #5074 #5102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/azd/pkg/project/service_target_aks.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ func (t *aksTarget) ensureClusterContext(
convertOptions := &kubelogin.ConvertOptions{
Login: "azd",
KubeConfig: kubeConfigPath,
TenantId: t.env.GetTenantId(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tenantId is not ensured to be in the azd-environment.

We have a way to resolve the tenantId for a project here: https://github.com/Azure/azure-dev/blob/main/cli/azd/cmd/auth_token.go#L84

Most cases, it is resolved from the subscription Id, which is ensured to be in the azd-env

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @vhvb1989 and got it... Couldn't we also get it directly from the cluster to ensure the kubelogin get-token command is for the exact tenant that it is deployed into and not worry about azd auth env variables?

Suggested change
TenantId: t.env.GetTenantId(),
TenantId: *managedCluster.Properties.AADProfile.TenantID,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me ping @wbreza as I am not very familiar with the managedCluster

}

if err := tools.EnsureInstalled(ctx, t.kubeLoginCli); err != nil {
Expand Down