1.1 KiB
1.1 KiB
AKS C# example using kubelogin + MSI
This example shows how to use the kubelogin to authenticate using managed identities with Azure Kubernetes Service (AKS) using the C# SDK.
Prerequisites
- turn on AAD support for AKS, see here
- create a managed identity for the AKS cluster
- assign the managed identity the
Azure Kubernetes Service RBAC Cluster Admin(or other RBAC permission) on the AKS cluster - assign the managed identity to the VM, see here
- install the kubelogin to your machine
Running the code
You must the the code on VM with MSI
- Replace
serverwith the address of your AKS cluster - Replace
clientidwith the client id of the managed identity - Replace
kubeloginwith the path to the kubelogin executable
dotnet run