Help for owners
My Microsoft 365 integration stopped because its secret expired
Short answer
An app that signs in to Microsoft 365 as itself uses a client secret, and Microsoft limits a secret's life to 24 months or less, recommending under 12. When it ends, the app stops. A new secret fixes it, but its value is shown only once. Microsoft recommends certificates for production.
Does this sound like your situation?
- An integration that ran for a long time stopped overnight.
- Sign-in errors mention the client secret, invalid client or expired credentials.
- Nobody knows who created the app registration or where its secret is stored.
- Mail, calendar or SharePoint automation from my app no longer works.
- It stopped on a date that is a year or two after setup.
Why does this happen?
Secrets have a fixed end date
Microsoft states that a client secret's lifetime is limited to two years (24 months) or less, that you cannot set a custom lifetime beyond that, and that it recommends an expiration of less than 12 months. When the date passes, the app can no longer prove who it is.
Confirmed by learn.microsoft.com
The value is shown only once
Microsoft states that the secret value is never displayed again after you leave the page where it is created. Whoever set it up had to copy it into the app. If a new secret is created but the old value stays in the app, nothing changes.
Confirmed by learn.microsoft.com
Secrets are the weaker option
Microsoft recommends a certificate rather than a client secret before moving an app to production, and says secrets are less secure and should not be used in production environments.
Confirmed by learn.microsoft.com
Nobody owns the renewal
The person who registered the app has left, or the registration sits in a tenant nobody checks, so no one saw the date coming.
The secret is stored in several places
The same secret may be pasted into a server setting, an automation tool and a script. Updating one leaves the others failing with the old value.
What can I do about it today?
- Ask a Microsoft 365 admin to open the app registrationIn the Microsoft Entra admin center, under App registrations, the Certificates and secrets page lists each secret and its expiry date.
- Write down where the secret is usedAsk your developer or automation owner which servers, tools and scripts hold it.
- Do not delete the old secret firstCreate the new one, put it everywhere it is needed, check it works, and only then remove the expired one.
- Never send the secret by email or chatGive it to the person who needs it through a password manager or a protected setting.
- Put the next expiry date in a calendarSet a reminder well before it, and name a person responsible.
When should I bring someone in?
- You cannot find the app registration or nobody is an admin of it.
- The secret is used in many places and you are unsure which.
- You want to replace secrets with certificates or another safer method.
How do I handle it?
- Find the registration and its usersI identify the app registration, the permissions it holds and every place the secret is used, from your side's list and the app's settings.
- Create the new credential alongside the oldA second credential is added, so the old one keeps working until the switch is checked.
- Update every place, then testServers, tools and scripts are updated and tested with a harmless request before the old credential is removed.
- Prefer a certificate or managed identityWhere the app can use a certificate or an Azure managed identity, as Microsoft recommends, I move it there so there is less to expire.
- Set reminders and an ownerYou get the expiry dates written down, and a named person who gets the reminder.
The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.
What do owners ask about this?
Can I make a secret that never expires?
No. Microsoft states a secret's lifetime is limited to 24 months or less. A certificate can be used instead, and it has its own expiry date.
I lost the secret value. Can it be shown again?
No. Microsoft states that the value is never displayed again after leaving the page. A new secret must be created and put in the app.
Will users be affected while this is fixed?
Anything that depends on the app signing in, such as automated mail or file jobs, is paused until the new credential is in place.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.
For your developer: the technical fixes
AADSTS90014: The request body must contain the following parameter: 'grant_type'.Entra ID token request fails: the request body must contain the parameter 'grant_type'The type or namespace name 'DelegateAuthenticationProvider' could not be foundDelegateAuthenticationProvider no longer exists in the Microsoft Graph .NET SDKIDX20803: Unable to obtain configuration from: 'https://login.microsoftonline.com/<tenant>/v2.0/.well-known/openid-configuration'.ASP.NET Core JwtBearer throws IDX20803: Unable to obtain configuration from the metadata address