When I use bitbucket pipeline to deploy aks , an unable to recognize error occurred.

StevenCheng71 1 Reputation point
2021-05-26T23:43:33.557+00:00

This is my screenshot.
99959-screen-shot-2021-05-27-at-072534.png

The pipeline run
$ az aks get-credentials
is success.

and
$ kubectl config use-context MY_AKS_NAME
success.

but
$ kubectl apply -f deployment.yml
is need to authenticate.

I can't to authenticate in continue deployment environment.
How to resolve it.

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,447 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. prmanhas-MSFT 17,946 Reputation points Microsoft Employee Moderator
    2021-05-27T07:25:38.467+00:00

    @StevenCheng71 Adding to @Dean Porter comment above yes he is right that you will need to create a Service Principal first in Azure .

    As mentioned here:

    You will need create a service principal with enough access to create an Azure App Service app. A service principal is an identity you can use in tools to interact with Azure. Use the following command to create a service principal.

    az ad sp create-for-rbac --name <name for your principal>

    This will give you a list of values that you can add to your variables in Bitbucket (in repository > Settings > Repository variables.

    Where:

    appId → AZURE_APP_ID

    password → AZURE_PASSWORD

    tenant → AZURE_TENANT_I

    You can the refer to above documentation for deployment yml samples.

    Hope it helps!!!

    Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.

    1 person found this answer helpful.

  2. Dean Porter 1 Reputation point
    2021-05-27T05:55:08.107+00:00

    I don't think you can use any type of interactive login, you will need to create an SPN in Azure and then specify that in the pipeline.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.