Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agent/azure: adds ability to use specific user-assigned managed identities for auto auth #14214

Merged
merged 6 commits into from Feb 23, 2022

Conversation

austingebauer
Copy link
Member

@austingebauer austingebauer commented Feb 23, 2022

Overview

This PR adds the ability to specify the object_id xor client_id when configuring Vault agent auto-auth for Azure. This enables users that have more than one user-assigned managed identity associated with their VM to specify which one they'd like to use when authenticating via Vault's Azure auth method.

Note that providing these parameters is an "exclusive or". During my testing, I saw that providing both resulted in an error:

curl -s -H Metadata:true 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/&client_id=redacted&object_id=redacted' | jq
{
  "error": "invalid_request",
  "error_description": "Only one of 'client_id', 'object_id', 'principal_id', or 'mi_res_id' may be provided"
}

Testing

I tested that using these parameters to request an access token works when more than one user-assigned managed identity is associated with a VM.

Tested auto-auth using both client_id and object_id for different user-assigned managed identities:

auto_auth {
  method "azure" {
    config = {
      role = "dev-role"
      resource = "https://management.azure.com/"
      client_id = "<client_id>"
      # object_id = "<object_id>"
    }
  }

  sink "file" {
    config = {
      path = "${WORKDIR}/tokens/vault.token"
    }
  }
}

@austingebauer austingebauer added this to the 1.10-rc1 milestone Feb 23, 2022
@austingebauer austingebauer requested a review from a team February 23, 2022 01:08
@vercel vercel bot temporarily deployed to Preview – vault February 23, 2022 01:16 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook February 23, 2022 01:16 Inactive
Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
Copy link
Contributor

@tomhjp tomhjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

command/agent/auth/azure/azure.go Show resolved Hide resolved
website/content/docs/agent/autoauth/methods/azure.mdx Outdated Show resolved Hide resolved
Copy link
Member

@calvn calvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one optional comment yesterday, but otherwise the PR looks good!

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants