-
Notifications
You must be signed in to change notification settings - Fork 175
Conversation
Friendly ping if a reviewer or maintainer can take a look at this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need clarification in the usage of the Jwt
field.
Yeah, I don't see any strong reason that the JWT would need to be exported in this instance. I updated the PR to make it internal. |
Anything still blocking this? I opened up two downstream issues where I would love to implement workload identities as soon as this is merged. |
There's an open question about how to handle the JWT expiring. @karlschriek how is your app handling this? |
We use this for "Azure Workload Identities" on Kubernetes. Essentially we annotate a Pod's ServiceAccount, such as: apiVersion: v1
kind: ServiceAccount
metadata:
name: external-dns
namespace: external-dns
labels:
azure.workload.identity/use: 'true'
annotations:
azure.workload.identity/client-id: bbbbbbbb-xxx-yyyyy-mmmm-rrrrrrrrrr
azure.workload.identity/service-account-token-expiration: '86400' # expiry after one day
azure.workload.identity/tenant-id: yyyyyyy-xxx-zzzz-xxxx-rrrrrrrrrrrrr Starting a Pod with the above service account results in the following ENV vars being mounted. AZURE_AUTHORITY_HOST: https://login.microsoftonline.com/
AZURE_CLIENT_ID: bbbbbbbb-xxx-yyyyy-mmmm-rrrrrrrrrr
AZURE_FEDERATED_TOKEN_FILE: /var/run/secrets/azure/tokens/azure-identity-token
AZURE_TENANT_ID: yyyyyyy-xxx-zzzz-xxxx-rrrrrrrrrrrrr In addition, a JWT token is mounted at the file location My understanding is that after |
Just for more info, in the apps (e.g. in awiClientId := os.Getenv("AZURE_CLIENT_ID")
awiTenantId := os.Getenv("AZURE_TENANT_ID")
jwtBytes, err := ioutil.ReadFile(os.Getenv("AZURE_FEDERATED_TOKEN_FILE"))
jwt := string(jwtBytes)
oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, awiTenantId)
spt, err := adal.NewServicePrincipalTokenFromFederatedToken(*oauthConfig, awiClientId, jwt, env.ResourceManagerEndpoint) |
By far the most convenient on client side would be to be able to pass for example |
Since the JWT has it's own expiry, there isn't a way to get refresh tokens using the JWT. Rather we are wrapping around this call to get a new JWT and then a new Azure access token when needed. Getting the JWT will be highly dependent on the Identity Provider in use. |
In response to issue #671, I took a pass at adding in capability of using OIDC JWTs. Completed the CLA.