HOTSPOT (Drag and Drop is not supported)You have a GitHub organization that contains a repository and an organizational secret named DB_Credential.You need to build a workflow that will configure a server by using PowerShell and DB_Credential.How should you complete the code? To answer, select the appropriate options in the answer area.Note: Each correct selection is worth one point.Hot Area:
Answer(s): A
Box 1: : ${{ secrets.DB_Credential}}Box 2: "$env:DB_Credential"Using secrets in a workflowTo provide an action with a secret as an input or environment variable, you can use the secrets context to access secrets you've created in your repository.Example using PowerShell steps:- shell: pwsh env:SUPER_SECRET: ${{ secrets.SuperSecret }}run: |example-command "$env:SUPER_SECRET"
https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets
DRAG DROP (Drag and Drop is not supported)You need to deploy a new project in Azure DevOps that has the following requirements:• The lead developer must be able to create repositories, manage permissions, manage policies, and contribute to the repository.• Developers must be able to contribute to the repository and create branches, but NOT bypass policies when pushing builds.• Project managers must only be able to view the repository.• The principle of least privilege must be used.You create a new Azure DevOps project team for each role.To which Azure DevOps groups should you add each team? To answer, drag the appropriate groups to the correct teams. Each group 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: ReadersProject managers must only be able to view the repository.Only read permission necessary.Box 2: Project AdministratorsThe lead developer must be able to create repositories, manage permissions, manage policies, and contribute to the repository.Add to the Project Collection Administrators security group users tasked with managing organization or collection resources.Box 3: ContributorsDevelopers must be able to contribute to the repository and create branches, but NOT bypass policies when pushing builds.Add to the Contributors security group full-time workers who contribute to the code base or manage projects.
https://docs.microsoft.com/en-us/azure/devops/organizations/security/look-up-project-collection-administrators
You are building a Microsoft ASP.NET application that requires authentication.You need to authenticate users by using Microsoft Entra ID.What should you do first?
Answer(s): B
Register your application to use Microsoft Entra ID. Registering the application means that your developers can use Microsoft Entra ID to authenticate users and request access to user resources such as email, calendar, and documents.
https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/developer-guidance-for-integrating-appli cations
SIMULATIONYou need to create a personal access token (PAT) named Token1 that has only the following capabilities:-Read, write, and manage code-Read and execute builds-Read releasesToken1 must expire in 60 days.
See explanation below.Azure DevOps, Use personal access tokensCreate a PATStep 1: Sign in to your organization (https://dev.azure.com/{Your_Organization}).Step 2: From your home page, open user settings and select Personal access tokens.Step 3: Select + New Token.Step 4: Name your token [Token1], select the organization where you want to use the token, and then set your token to automatically expire after a set number of days [Set expire after 60 days].Step 5: Select the scopes for this token to authorize for your specific tasks.[Select:Read, write, and manage codeRead and execute buildsRead releases ]Step 6: Click Create
https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authent icate
DRAG DROP (Drag and Drop is not supported)You have a project in Azure DevOps that contains a pipeline named Pipeline1.You have an Azure subscription that contains an Azure key vault named Vault1. Vault1 contains a secret named Secret1.You need to ensure that you can use Secret1 in Pipeline1. The solution must meet the following requirements:-Secret1 must be fetched at runtime.-Secret1 must NOT be stored in plaintext.Which three actions should you perform in sequence? To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.Select and Place:
To securely fetch and use an Azure Key Vault secret at runtime without storing it in plaintext, you must link Azure DevOps to your Azure subscription and pull the secret as an encrypted pipeline variable.Here are the precise steps to configure this setup.Step 1: From Azure DevOps, create a service connection named Connection1.1. Create an Azure Resource Manager Service ConnectionThis gives your Azure DevOps project permission to communicate with your Azure subscription.In Azure DevOps, open your project and go to Project settings > Service connections.Click New service connection and select Azure Resource Manager.Choose Workload Identity Federation (automatic) (recommended for security) or Service Principal (automatic). Select your Azure subscription, resource group, and give the connection a descriptive name (e.g., Azure-Subscription-Conn).Click Save.Step 2: Add a new access policy to Vault1. Grant the Get and List permissions for secrets to Connection1.2. Grant the Pipeline Access to Azure Key VaultYour pipeline's service connection identity needs permission to read secrets from the Key Vault.Open your Azure Key Vault.Go to Access policies (or Azure RBAC depending on your vault configuration).Grant Get and List permissions directly to the Service Principal / App Registration created by your Azure DevOps Service Connection in Step 1.Incorrect for step 2:* Create a managed identity for the Azure Pipelines agent and grant Get permissions for Vault1 to the managed identityA Managed Identity belongs to an Azure resource (like a VM hosting a self-hosted agent). If you use Microsoft-hosted agents, they cannot use a standard managed identity this way. Instead, the Service Connection itself creates an identity in Azure.Step 3: From Azure DevOps Variable, create a variable Group and link the group to Vault1.3. Fetch the Secret at Runtime in the PipelineYou can consume the secret securely using one of two standard methods. Both methods inject the secret dynamically at runtime and mask the values as *** in build logs.One option is to Link Key Vault to an Azure DevOps Variable Group (Best for sharing across pipelines) In Azure DevOps, go to Pipelines > Library.Click + Variable group and check the option to Link secrets from an Azure key vault as variables.Select your service connection and your Key Vault name.Click + Add to select the specific secrets you want to import, then save.Reference the variable group in your pipeline YAML.
https://www.xavor.com/blog/securing-azure-devops-pipelines/
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.