ExamGecko
Home Home / Microsoft / AZ-400

Microsoft AZ-400 Practice Test - Questions Answers, Page 45

Question list
Search
Search

List of questions

Search

Related questions











LAB 6

You have an Azure function hosted in an App Service plan named az400-38443478-funct

You need to configure az400 38443478-funcl lo update the functions automatically whenever new code is committed to the main branch of https://githubcom/Azure-Samples/functions-quickstart.

NOTE: Access to GitHub is blocked in the exam environment. Access to GitHub is NOT required to complete the task successfully.

A.
See the solution below in explanation
A.
See the solution below in explanation
Answers
Suggested answer: A

Explanation:

To configure your Azure Function az400-38443478-funct to automatically update whenever new code is committed to the main branch of the specified GitHub repository, you can use GitHub Actions for continuous deployment. Here's how to set it up:

Create a GitHub Actions Workflow:

In your GitHub repository, navigate to the .github/workflows/ directory.

Create a new file for your workflow (e.g., azure-function-cd.yml).

Define the Workflow:

In the workflow file, define the steps for the build and deployment process.

Use the Azure/functions-action to deploy to your Azure Function App.

Set up triggers for the main branch to initiate the workflow on every commit.

Generate Deployment Credentials:

In the Azure Portal, navigate to your Function App az400-38443478-funct.

Download the publish profile from the Overview section by clicking on Get publish profile.

Store the Publish Profile as a GitHub Secret:

In your GitHub repository, go to Settings > Secrets and variables > Actions.

Create a new secret (e.g., AZURE_FUNCTIONAPP_PUBLISH_PROFILE) and paste the content of the publish profile.

Configure the Workflow to Use the Secret:

In the workflow file, reference the secret to authenticate the deployment to Azure.

Here's a sample GitHub Actions workflow snippet:

name: Deploy Azure Function

on:

push:

branches:

- main

jobs:

build-and-deploy:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: Set up Python version

uses: actions/setup-python@v2

with:

python-version: '3.x'

- name: Install dependencies

run: |

pip install -r requirements.txt

- name: Deploy to Azure Functions

uses: Azure/functions-action@v1

with:

app-name: az400-38443478-funct

publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}

package: .

Replace the app-name with the name of your Azure Function App and ensure the Python version and dependencies match your application's requirements.

By following these steps, your Azure Function will automatically update whenever new code is pushed to the main branch of the GitHub repository. This setup minimizes manual effort and ensures that your function app is always running the latest code.

LAB 7

You need to prepare a network security group (NSG) named az400 38443478 nsgl to host an Azure DevOps pipeline agent. The solution must allow only the required outbound port for Azure DevOps and deny all other inbound and outbound access to the Internet

A.
See the solution below in explanation
A.
See the solution below in explanation
Answers
Suggested answer: A

Explanation:

To prepare a Network Security Group (NSG) named az400-38443478-nsg1 for hosting an Azure DevOps pipeline agent, while allowing only the required outbound port for Azure DevOps and denying all other inbound and outbound access to the Internet, follow these steps:

Create the NSG:

Navigate to the Azure Portal.

Go to Network Security Groups and click on + Create.

Fill in the details, including the name az400-38443478-nsg1, and create the NSG.

Configure Outbound Security Rules:

Once the NSG is created, go to its settings.

Navigate to Outbound security rules.

Click on + Add to create a new rule.

Set the Destination port ranges to 443, which is the required port for Azure DevOps12.

Set the Protocol to TCP.

Set the Action to Allow.

Assign a Priority number (e.g., 100) that does not conflict with existing rules.

Provide a meaningful Name for the rule (e.g., AllowAzureDevOps).

Configure Default Rules to Deny All Other Traffic:

In the same Outbound security rules section, edit the default rule to deny all traffic.

Change the Action to Deny for the rule with the lowest priority (highest number).

Ensure that this rule applies to all protocols, source and destination IP ranges, and port ranges.

Associate the NSG with the Appropriate Resource:

Associate the NSG with the subnet or network interface of the virtual machine or resource where the Azure DevOps pipeline agent will be hosted.

By following these steps, you will ensure that the Azure DevOps pipeline agent can communicate with Azure DevOps services over the required port while blocking all other inbound and outbound Internet access, adhering to the principle of least privilege and security best practices.

LAB 8

You need to ensure that the https://contoso.com/statushook webhook is called every time a repository named az40038443478acr 1 receives a new version of an image named dotnetapp

A.
See the solution below in explanation
A.
See the solution below in explanation
Answers
Suggested answer: A

Explanation:

To ensure that the webhook at https://contoso.com/statushook is called every time the repository named az40038443478acr1 receives a new version of an image named dotnetapp, you can follow these steps to configure a webhook in Azure Container Registry:

Navigate to the Azure Container Registry:

Go to the Azure Portal.

Find and select your Azure Container Registry instance az40038443478acr1.

Create a New Webhook:

Under Services, select Webhooks.

Click on + Add to create a new webhook.

Fill in the form with the following information:

Webhook name: Enter a unique name for your webhook.

Service URI: Enter https://contoso.com/statushook.

Custom headers: (Optional) Add any headers you want to pass along with the POST request.

Trigger actions: Select Push to trigger the webhook on image push events.

Scope: Specify the scope as az40038443478acr1:dotnetapp to target the specific image.

Status: Set to Enabled.

Save the Webhook Configuration:

Review the information and click Create to save the webhook.

Once configured, the webhook will send a POST request to https://contoso.com/statushook whenever a new version of the dotnetapp image is pushed to the az40038443478acr1 repository in your Azure Container Registry1.

This setup will automate the notification process, ensuring that the specified webhook is called with each new image version, thus fulfilling the task requirements.

You plan to deploy a solution that will include multiple microservices.

You need to recommend a deployment strategy for the microservices. The solution must meet the following requirements:

* Enable users to test new features by using a specific URL.

* Minimize the effort required to promote a test version to production.

* Minimize the effort required to revert production code to the previous version.

Which strategy should you recommend?

A.
A/B
A.
A/B
Answers
B.
feature toggle
B.
feature toggle
Answers
C.
progressive exposure
C.
progressive exposure
Answers
D.
blue/green
D.
blue/green
Answers
Suggested answer: A

You have an Azure subscription.

You use Bicep templates to deploy websites and Azure SQL infrastructure.

You need to automate the deployments by using Azure Pipelines and a self-hosted agent that runs on two virtual machines. The solution must minimize administrative effort.

What should you do first?

A.
Create an Azure Automation account.
A.
Create an Azure Automation account.
Answers
B.
On each virtual machine, enable a system-assigned managed identity.
B.
On each virtual machine, enable a system-assigned managed identity.
Answers
C.
Create a user-assigned managed identity.
C.
Create a user-assigned managed identity.
Answers
D.
Create a service principal.
D.
Create a service principal.
Answers
Suggested answer: D

HOTSPOT

You have a .NET app named App1.

You need to upload App1 to GitHub Packages.

How should you complete the command? To answer, select the appropriate options in the answer area.

NOTE: Each correct selection is worth one point.


Question 446
Correct answer: Question 446

You have an app that is deployed to two environments named Production-A and Production-B by using Azure Pipelines.

You need to configure a release pipeline that will mark the app as complete and ready for release into the Production-B environment. The solution must meet the following requirements:

* Ensure that there are no active Azure Monitor alerts in the Production-A environment before the app is marked as complete.

* Minimize administrative effort.

What should you do?

A.
To the Production-B environment stage, add a pre-deployment gate that will query Azure Monitor.
A.
To the Production-B environment stage, add a pre-deployment gate that will query Azure Monitor.
Answers
B.
To the Production-A environment stage, add a post-deployment gate that will query Azure Monitor.
B.
To the Production-A environment stage, add a post-deployment gate that will query Azure Monitor.
Answers
C.
To the Production-A environment stage, add a post-deployment approval.
C.
To the Production-A environment stage, add a post-deployment approval.
Answers
D.
To the Production-A environment stage, add a pre-deployment gate that will query Azure Monitor.
D.
To the Production-A environment stage, add a pre-deployment gate that will query Azure Monitor.
Answers
Suggested answer: B

HOTSPOT

You are using an Azure Pipelines pipeline to build and deploy a web app.

You need to implement a testing strategy that meets the following requirements:

* Validates the scalability of the app

* Tests a code module without testing the module's dependencies

* Validates the interactions and dependencies between the app and its dependent services

Which type of test should you implement for each requirement? To answer, select the appropriate options in the answer area.


Question 448
Correct answer: Question 448

DRAG DROP

You have an Azure subscription that contains 50 virtual machines.

You manage the configuration of the virtual machines by using Azure Automation State Configuration.

You need to ensure that Windows Defender is installed on each virtual machine and the Windows Defender service is running.

How should you complete the Desired State Configuration (DSC) code? 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.


Question 449
Correct answer: Question 449

DRAG DROP

You have an Azure Repos repository named Repo1 that is used for source control.

You need to configure code scanning for Repo1.

Which three tasks should the pipeline perform in sequence? To answer, move the appropriate tasks from the list of tasks to the answer area and arrange them in the correct order


Question 450
Correct answer: Question 450
Total 482 questions
Go to page: of 49