microsoft / microsoft/template-validation-action

Support for Managed Identity

Open
#86 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
24
Forks
11
Avg merge
17h 10m
Merged PRs (30d)
1

Description

Template validation action authenticates to Azure CLI using service principal, from logs:

az login --service-principal -u "***" --federated-token $AZURE_AD_TOKEN --tenant "***"

Logged in to Azure as (***)

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

My template is currently using managed identity to authenticate with the template validation workflow. In this case, -u "***" is the client-id of a managed identity (as opposed to a service principal). az login succeeds, but there seems to be some issue with permissions. The managed identity has Owner permissions on the subscription being deployed to, but the validation is failing claiming that it is missing permissions. The particular location of this failure is within post-provisioning azd hooks. Here, the template is using the local identity (in the case of the validation action, the managed identity) to perform various data-plane operations on Azure.

Perhaps this is related to logging in as a service principal with a managed identity?

Regardless, could the template validation action support managed identity? I imagine that when managed identity authentication is enabled, the az login command would change to:

az login --identity --client-id "***" --federated-token $AZURE_AD_TOKEN --tenant "***"

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Azure CLI authentication entry point and review how the post-provisioning azd hooks obtain credentials for data-plane operations. Compare the current service-principal login with the requested managed-identity login, then run the template validation workflow against a managed identity; done means authentication succeeds and the hooks complete without permission errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
authentication, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.