A developer ran azd up, which provisioned a Microsoft Foundry project and generated a .env file containing the project connection details and the deployed agent ID. The developer now shares the repository with other learners. The other learners must be able to see which environment variables the application expects. The values in the generated .env file must not be committed to the repository.
What should the developer do with the environment configuration files?
The generated .env file holds the connection details for the Foundry project and agent, so it is excluded from source control through .gitignore. To tell others which variables are needed, the repository includes a .env.example template with placeholder values. This combination shares the required variable names without committing the generated values.
- Not correct: Commit the generated
.envfile so that other learners reuse its values. Committing.envwould place the generated connection details in the repository, which the plan avoids by listing.envin.gitignore. - Not correct: Add both
.envand.env.exampleto.gitignoreand commit neither. The.env.examplefile is the template that shows the required variables; ignoring it hides that information from other learners. - Not correct: Copy the generated values into
azure.yamland commit that file. In the plan,azure.yamlis the azd configuration file; moving the generated values into a committed file still exposes them in the repository. - Correct: Add
.envto.gitignoreand commit a.env.examplefile with placeholder values. The plan keeps.envin.gitignoreto prevent secret exposure and provides.env.exampleas a template that shows the required variables, which meets both requirements.
- Lab: Trail Guide Agent Technical Plangithub.com