Free AZ-400 Exam Braindumps
Designing and Implementing Microsoft DevOps Solutions Questions 121–125 (page: 26)

Updated On: 10-Mar-2026

You have a GitHub repository that contains multiple versions of an Azure Pipelines template.

You plan to deploy multiple pipelines that will use a template stored in the repository.

You need to ensure that you use a fixed version of the template.

What should you use to reference which version of the template repository to use?

  1. the serial
  2. the SHA-based hashes
  3. the runner
  4. the branch

Answer(s): D

Explanation:

Repositories are resolved only once, when the pipeline starts up. After that, the same resource is used for the duration of the pipeline. Only the template files are used. Once the templates are fully expanded, the final pipeline runs as if it were defined entirely in the source repo. This means that you can't use scripts from the template repo in your pipeline.
If you want to use a particular, fixed version of the template, be sure to pin to a ref. The refs are either branches (refs/heads/<name>) or tags (refs/tags/<name>). If you want to pin a specific commit, first create a tag pointing to that commit, then pin to that tag.
Note: If no ref is specified, the pipeline will default to using refs/heads/main.


Reference:

https://github.com/MicrosoftDocs/azure-devops-docs/blob/main/docs/pipelines/process/ templates.md



DRAG DROP (Drag and Drop is not supported)

You use Git for source control.

You delete a file, commit the changes, and continue to work.

You need to recover the deleted file.

Which three commands should you run in sequence? To answer, move the appropriate commands from the list of commands to the answer area and arrange them in the correct order.

Select and Place:

  1. See Explanation section for answer.

Answer(s): A

Explanation:




Step 1: git log.
Find the commit SHA of the commit you want to revert to. To look through a log of commits, type git log.

Step 2: git checkout [hash]~1 --path/to/file
If you have deleted the file and already committed the changes, you need to use the `git checkout` command to restore the file. First, you need to find out the checksum of the commit that deleted the file, and then check out the file from the previous commit.

This command tells `git` to list all commits, which can be reached from the HEAD, that changed the file `file1.txt`. The `-n 1` option tells `git` to limit the result to only one commit. The output is the checksum of the commit that deleted the file.

To undo changes on a single file or directory from commit B, but retain them in the staged state:

git checkout <commit-B-SHA> <file

Step 3: git restore path/to/file
To unstage the file but keep your changes:

git restore --staged <file>

Note: Recovering Deleted Files with the Command Line
Recovering a deleted file using the Git command line involves the `git restore` or `git checkout`command.
Whenever you modify files in Git--including creating new files, editing, or deleting existing files--the changes start as unstaged. Then you stage the changes with the `git add` command, and finally, you commit the changes using the `git commit` command. Git provides ways to recover a deleted file at any point in this life cycle of changes.

If you have not staged the deletion yet, simply run `git restore <filename>` and the file will be restored from the index.


Reference:

https://rewind.com/blog/recovering-deleted-files-in-github/
https://docs.gitlab.com/ee/topics/git/numerous_undo_possibilities_in_git/



DRAG DROP (Drag and Drop is not supported)

You have an Azure Repos repository named repo1.

You need to clone repo1. The solution must clone only a directory named src/web.

How should you complete the script? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.

Note: Each correct selection is worth one point.

Select and Place:

  1. See Explanation section for answer.

Answer(s): A

Explanation:




Box 1: https://dev.azure.com/organization/project/_git/repo1 If you are considering using Scalar with the GVFS protocol and Azure Repos, then you can try cloning a new enlistment using scalar clone <url>. Scalar automatically registers this new enlistment, so it will benefit from all the config options and maintenance described above.

Example: By following the snippet below, you can clone a mirror of the Scalar source code using the GVFS protocol:

$ scalar clone https://dev.azure.com/ms-scalar/_git/scalar
Clone parameters:
Repo URL: https://dev.azure.com/ms-scalar/_git/scalar
Branch: Default
Etc.

Box 2: repo1/src
The solution must clone only a directory named src/web

When using scalar clone, the working directory contains only the files at root using the Git sparse-checkout feature in cone mode. You can expand the files in your working directory using the git sparse-checkout set command.

Example continued:
$ cd scalar/src

Box 3: web
Example continued:
git sparse-checkout set Scalar Scripts/Mac


Reference:

https://devblogs.microsoft.com/devops/introducing-scalar/



DRAG DROP (Drag and Drop is not supported)

You have a GitHub repository named repo1.

You migrate repo1 to an Azure Repos repository named repo2.

After the migration, changes are made to repo1.

You need to sync the changes to repo2.

How should you complete the script? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.

Note: Each correct selection is worth one point.

Select and Place:

  1. See Explanation section for answer.

Answer(s): A

Explanation:




Box 1: repo1 repo URL
Manually import a repo using git CLI
You can follow these steps to manually import a repo into an Azure DevOps Services repo by replacing TFS with Azure Repos in the following steps.

1. Clone the source repo to a temporary folder on your computer using the bare option, as shown in the following command line example, and then navigate to the repo's folder.
When cloning using the bare option, the folder name includes the .git suffix. In this example, https://github.com/contoso/old-contoso-repo.git is the source repo to be manually imported.

git clone --bare https://github.com/contoso/old-contoso-repo.git cd old-contoso-repo.git

Box 2: repo1

2. Create a target repo using TFS 2017 RTM, and make a note of the clone URL. In this example, https:// dev.azure.com/contoso-ltd/MyFirstProject/_git/new-contoso-repo is the URL for the new target repo.

Run the following command to copy the source repo to the target repo.

git push --mirror https://dev.azure.com/contoso-ltd/MyFirstProject/_git/new-contoso-repo

Box 3: repo2 clone URL


Reference:

https://learn.microsoft.com/en-us/azure/devops/repos/git/import-git-repository



You manage code by using GitHub.

You need to ensure that repository owners are notified if a new vulnerable dependency or malware is found in their repository.

What should you do?

  1. Configure CodeQL scanning actions.
  2. Configure Dependabot alerts.
  3. Configure branch protection rules for each repository.
  4. Subscribe all the repository owners to the GitHub Advisory Database.

Answer(s): B

Explanation:

Identifying vulnerabilities in your project's dependencies with Dependabot alerts Dependabot generates Dependabot alerts when known vulnerabilites are detected in dependencies that your project uses.
GitHub sends Dependabot alerts when we detect that your repository uses a vulnerable dependency or malware.


Reference:

https://docs.github.com/en/code-security/dependabot/dependabot-alerts/about-dependabot-alerts



Viewing page 26 of 72
Viewing questions 126 - 130 out of 398 questions


Post your Comments and Discuss Microsoft AZ-400 exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!