CircleCI-Public / CircleCI-Public/azure-cli-orb

Cant login with service principals on 1.3.2

Open
#32 3 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Shell
Stars
3
Forks
12
PR merge metrics
No merged PRs in 30d

Description

### Orb version

```
azure-cli: circleci/azure-cli@1.3.2
```

### What happened

When I try to login with service principal using this latest version, I got an error like below.

**My circleci.yml file**

```yaml
version: 2.1

orbs:
azure-cli: circleci/azure-cli@1.3.2

jobs:
auth_on_azure:

docker:
- image: cimg/base:stable

steps:
- checkout
- azure-cli/install
- azure-cli/login-with-service-principal

workflows:
deploy:
jobs:
- auth_on_azure:
context:
- my_environment
```

The context `my_environment` has the variables `AZURE_SP`, `AZURE_SP_PASSWORD` and `AZURE_SP_TENANT`.

**The error on Circle CI**

> Failed to resolve tenant 'AZURE_SP_TENANT'.
>
> Error detail: {"error":"invalid_tenant","error_description":"AADSTS90002: Tenant 'azure_sp_tenant' not found. Check to make sure you have the correct tenant ID and are signing into the correct cloud. Check with your subscription administrator, this may happen if there are no active subscriptions for the tenant. Trace ID: ... Correlation ID: ... Timestamp: ...","error_codes":[90002],"timestamp":"...","trace_id":"...","correlation_id":"...","error_uri":"https://login.microsoftonline.com/error?code=90002"}

### Expected behavior

When I use the version `1.2.2` it works as expected, without any other changes.

**My circleci.yml file using the 1.2.2 version**

```yaml
version: 2.1

orbs:
azure-cli: circleci/azure-cli@1.2.2

jobs:
auth_on_azure:

docker:
- image: cimg/base:stable

steps:
- checkout
- azure-cli/install
- azure-cli/login-with-service-principal

workflows:
deploy:
jobs:
- auth_on_azure:
context:
- my_environment
```

**The step output on Circle CI**

```
[
{
"cloudName": "AzureCloud",
"homeTenantId": "************************************",
"id": "...",
"isDefault": true,
"managedByTenants": [],
"name": "...",
"state": "Enabled",
"tenantId": "************************************",
"user": {
"name": "************************************",
"type": "servicePrincipal"
}
}
]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the azure-cli/login-with-service-principal entry point and compare its behavior in orb versions 1.3.2 and 1.2.2 using the provided circleci.yml and context variables. Reproduce the tenant-resolution error, then confirm that service-principal authentication succeeds with the 1.3.2 configuration without changing the variables.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, shell
Domain
authentication, cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.