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?
Answer(s): D
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.
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:
Answer(s): A
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/fileIf 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> <fileStep 3: git restore path/to/fileTo unstage the file but keep your changes:git restore --staged <file>Note: Recovering Deleted Files with the Command LineRecovering 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.
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:
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/scalarClone parameters:Repo URL: https://dev.azure.com/ms-scalar/_git/scalarBranch: DefaultEtc.Box 2: repo1/srcThe solution must clone only a directory named src/webWhen 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/srcBox 3: webExample continued:git sparse-checkout set Scalar Scripts/Mac
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:
Box 1: repo1 repo URLManually import a repo using git CLIYou 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.gitBox 2: repo12. 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-repoBox 3: repo2 clone URL
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?
Answer(s): B
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.
https://docs.github.com/en/code-security/dependabot/dependabot-alerts/about-dependabot-alerts
Post your Comments and Discuss Microsoft AZ-400 exam prep with other Community members:
Our website is free, but we have to fight against AI bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the AZ-400 content, but please register or login to continue.