Microsoft Teams App - secret client expired for local app

Julianna Cardenas 0 Reputation points
2025-07-01T05:18:03.3666667+00:00

I have a node.js MS Teams app that had its client secret keys expire for both my local and production apps. Production is fine after adding a new client secret and updating the env vars in Microsoft Azure. As for the local app, I added a new client secret but have no idea where to put it. I tried putting it in my .env.teamsfx.local file but everytime i run and it goes through the provisioning and deploying steps in the teamsapp.local.yml, the .env.teamsfx.local file gets overwritten with the previous client secret and I don't understand where it's getting it from. It doesn't exist anywhere else in the codebase and it's been deleted from the list of secrets in Microsoft Entra Admin Center.

How can I get my local MS Teams app to see the new client secret?

Thank you,

Juli

Microsoft Teams | Development
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Prasad-MSFT 9,071 Reputation points Microsoft External Staff Moderator
    2025-07-01T13:07:13.13+00:00

    TeamsFx stores environment state and secrets in the .fx folder:

    • .fx/states/state.local.json (and possibly .fx/states/state.dev.json or similar)
    • .fx/configs/config.local.json

    The client secret is cached in these files and is used to regenerate .env.teamsfx.local during TeamsFx CLI operations.


    How to update the client secret for local development:

    1. Update the secret in Azure (already done).
    2. Update the secret in TeamsFx state/config files:
      • Open .fx/states/state.local.json and look for the property (often under solution or azureAdApp): "clientSecret": "old_secret_value"
      • Replace it with your new client secret.
      • If you see a clientSecret in .fx/configs/config.local.json, update it there as well
    3. Regenerate your .env.teamsfx.local:
      • Delete the existing .env.teamsfx.local file (optional, but ensures a fresh start).
      • Run teamsfx provision or teamsfx deploy again. The toolkit will use the updated value from the state/config files.
    4. Verify: After running the above, check .env.teamsfx.local to ensure the new secret is present.

    Thanks, 

    Prasad Das 

    ************************************************************************* 

    If the response is helpful, please click on "upvote" button. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.


  2. Dora-T 2,195 Reputation points Microsoft External Staff Moderator
    2025-07-01T13:35:07.21+00:00

    Hi @Julianna Cardenas

    Thank you for reaching out to Microsoft Q&A Forum.  

    It sounds like the issue may be related to how your local environment is configured. To better understand what might be happening, could you let me know if you're currently running the app on a Windows Server machine, or on something like a regular Windows PC, WSL, Docker, or a remote development environment? 

    If I’ve misunderstood any part, please feel free to correct me. A bit more detail about your setup will help me pinpoint where the old secret might still be coming from and how best to assist you.  

    I'm looking forward to your response. 


  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.