We ran into an issue this morning where we needed to renew our Azure DevOps Service Connection’s expired secret but there is no officially supported way to do this. The error was
AADSTS7000215 - invalid clientid or secret. Thankfully, it’s not that difficult to solve.
Fake a change
- Open your project in ADO (https://dev.azure.com/[GROUP]/[PROJECT])
- At the bottom-left, choose Project settings
- In the Pipelines section, choose Service connections
- Select the service connection you’re having issues with
- If you click the Edit Service Principal link, you should see a red warning at the top of the page stating that one or more secrets for this service principal have expired; you can verify this by clicking the Certificates and secrets link on the blade and seeing that the single secret expired in the past
- Close this tab
- Click the Edit button
- You’ll notice there is no visible way to actually refresh the secret, however if you first click Verify (which should fail), make a simple change to the Description (add an extra space, for example; anything to make it different than it was)
- Now click Save
- Now if you re-open the Edit Service Principal link, you should no longer see the warning about expired secrets, and if you go to the Certificates and secrets link on the blade, there should be exactly one secret and should be valid for 2 years from today’s date
Now, if you ever need to renew an Azure DevOps Service Connection’s expired secret, hopefully you can avoid wasting precious time by trying to figure out how to do it manually and just trick the system into doing it for you.