Work on kubernetes with two accounts in PowerShell with Azure

11/12/2019

I have two separate Azure accounts.

One for each project in which I am involved, these accounts are totally independent, that is, they do not share any type of resource and do not have the same domain. They are from two totally different companies.

I find that both accounts respond to me at the time of login from PowerShell and I can access those resources.

Both work with Kubernetes (kubectl) but only one of the two accounts is shown. Whatever you do always shows the content of co-owners of one and not the other.

I have the Azure CLI (v.2.0.76) and the PS version is (5.1)

someone know how to I can do?

  • EDIT with pictures -

Although the account is default, I am not able to access the kubernetes of the same

PS Default Account

Services from the other account..not the default account

services from other cluster

-- llopezt
account
azure
kubectl
kubernetes
powershell

1 Answer

11/12/2019

I just found the solution.

When we access from PS with Az Login and select the account, it allows us to access all the resources of that account (the one that is predetermined)

What I have done is basically see the

kubectl config view

This returns the result of all the clusters that it finds with its context. The next thing we have to do is tell kubectl what CONTEXT we want to work with in the following way:

kubectl config use-context "CONTEXT NAME"

And thats it.

-- llopezt
Source: StackOverflow