-
Notifications
You must be signed in to change notification settings - Fork 348
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
Key rotation/ multiple client secrets #2596
Comments
@twenzel : this might be more a feature for Microsoft.Identity.Web (which already processes the certificates this way). |
@jmprieur could you link me to the documentation on using certs that auto rotate? If i understand correctly I would use put them in a keyvault and my appsettings.json would reference it. My azure ad app would just have an empty list of secrets/certs then, right? |
@sander1095 - cert support in Microsoft.Identity.Web (MIW) is described here https://github.com/AzureAD/microsoft-identity-web/wiki/Certificates#using-certificates-with-microsoftidentityweb If you keep your cert in KeyVault, MIW will attempt to re-load the cert when it sees that the current cert has expired. KeyVault allows you to store multiple certificates under the same name. So the way it would work end to end is:
App is now in production and works fine. When you are nearing the expiry for RSA1 you:
Now 2 things can happen: A. if your app is restarted for some reason, it will pull RSA2 from KeyVault and use it, even if RSA1 is still valid. |
So if I understand correctly it will still require some effort and timing? It feels like a SSL scenario that often are forgotten to be refreshed. I can not make this a "set it up once, never worry about it again" thing? |
@sander1095 : can you please elaborate on the SSL scenario? I don't understand how MSAL could be involved? |
Sorry, that was a bad example. Ssl is not related to MSAL at all. Let me explain: Currently I use a Client Secret which expires in 2023. I have to set up calendar events, alerts, notify other colleagues, etc.. so no one forgets to refresh this secret in 2023. This is whaf I compared SSL certs to; devs that dont have auto-refreshin SSL certs on their site often forget to refresh them and get invalid certs. Letsencrypt made this a lot easier by allowing you to automate it. Furthermore, Client Secrets are not recommended for prod scenario's. So I want to use certs. But I would like to use a cert and never worry about it again, or as little as possible. So it should refresh automatically? PS: What is that Send5Xc you mentioned? |
send5xc is a feature available only for some 1st Microsoft internal tenants by which the certificate is identified via it's CA chain instead of the thumbprint. It's better described here. Trust is based on Subject Name and Issuer instead of thumbprint. Unfortunately I am not aware if this feature will be made available for 3rd parties, because it's difficult to enforce that one and only one issuer is associated with a tenant. Key Vault offers a auto-rotation - see https://docs.microsoft.com/en-us/azure/key-vault/certificates/tutorial-rotate-certificates#update-lifecycle-attributes-of-a-stored-certificate. This allows you to load a certificate from KV based on its name. But you still have to manually / or via automation upload each cert to AAD, since AAD needs to know the thumbprint of a cert (x5t). I think more automation here is what you are looking for? |
I just got it to work, so I don't need further help. But I do have the following suggestions/findings:
Perhaps some code suggestions:
|
Great feedback, thanks @sander1095 . CC @jmprieur @henrik-me |
Guidance (for both 1p and 3p) is to use Managed Identity as it provides cert-less auth. |
Since Microsoft changed the Azure App ClientSecret policy, the secrets expires after max 2 years.
It's possible to add mulitple secrets to the Azure App but this client library does not support a mechanims like key rotation.
Please implement a feature to store/configure multiple client secrets and the "correct" one will be retrieved to aquire a token.
The text was updated successfully, but these errors were encountered: