Configure Environment Variables for kubectl and run kubectl

To configure the environment variables for kubectl, follow the steps below:

  1. In the control panel of the local machine, open Advanced System Settings > System properties.
  2. Click Environment Variables, and in the System Variables, enter the kubectl path as shown below.

  3. After setting the environment variable for kubectl, in the command prompt, run the “Az login” command.
  4. As a result, a prompt to enter credentials for azure portal will be displayed. Login with the credentials.
  5. On successful login, the status will be displayed in the command prompt as shown below.

  6. Open the cluster and click Connect.

  7. Run the command highlighted in green color section in above screen shot. The result should appear as below screen shot. On successful execution, the cluster and local machine are connected.