exam questions

Exam AZ-400 All Questions

View all questions & answers for the AZ-400 exam

Exam AZ-400 topic 4 question 25 discussion

Actual exam question from Microsoft's AZ-400
Question #: 25
Topic #: 4
[All AZ-400 Questions]

DRAG DROP -
You are configuring an Azure DevOps deployment pipeline. The deployed application will authenticate to a web service by using a secret stored in an Azure key vault.
You need to use the secret in the deployment pipeline.
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:

Show Suggested Answer Hide Answer
Suggested Answer:
Step 1: Create a service principal in Azure Active Directory (Azure AD).
You will need a service principal to deploy an app to an Azure resource from Azure Pipelines.
Step 2: Configure an access policy in the key vault.
You need to secure access to your key vaults by allowing only authorized applications and users. To access the data from the vault, you will need to provide read
(Get) permissions to the service principal that you will be using for authentication in the pipeline.
Select Access policy and then select + Add Access Policy to setup a new policy.

Step 3: Add an Azure Resource Manager service connection to the pipeline
You need to authorize the pipeline to deploy to Azure:
1. Select Pipelines | Pipelines,
2. Go to Releases under Pipelines and then select and Edit your pipeline.
3. Under Tasks, notice the release definition for Dev stage has a Azure Key Vault task. This task downloads Secrets from an Azure Key Vault. You will need to point to the subscription and the Azure Key Vault resource.
4. Click Manage, this will redirect to the Service connections page.

5.Click on New Service connection -> Azure Resource Manager -> Service Principal (manual). Fill the information from previously created service principal.
Reference:
https://azuredevopslabs.com/labs/vstsextend/azurekeyvault/

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
jeet1985
Highly Voted 3 years, 4 months ago
Answer should be B,C, E There is no way to directly create a service principal using the Azure portal. When you register an application through the Azure portal, an application object and service principal are automatically created in your home directory or tenant. https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal
upvoted 43 times
Robert12345Robert
3 years, 1 month ago
You can: az ad sp create-for-rbac -n ServicePrincipalName
upvoted 7 times
AzureJobsTillRetire
1 year, 9 months ago
This is not correct, as the answer is to use access policy and not rbac for the app
upvoted 1 times
catfood
1 year, 3 months ago
rbac is used to create the service principal. key vault can use either RBAC or access policy, RBAC is recommended
upvoted 1 times
...
...
...
KhabibcandefeatGSP
3 years, 3 months ago
This seems like the most correct sequence.
upvoted 1 times
...
lesiris
3 years, 3 months ago
I think this is the right answer https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#app-registration-app-objects-and-service-principals
upvoted 2 times
lesiris
3 years, 3 months ago
After some thinking not sure about it ... It's written nowhere that the portal is mandatory. We can simply create a service principal using the Azure Cli (az ad sp create-for-rbac). So for me the given answer is correct
upvoted 6 times
...
...
ThomasKong
3 years, 2 months ago
agree with this answer .
upvoted 2 times
...
...
erico
Highly Voted 3 years, 4 months ago
The answer is correct: First create a service principal. Ensure to give the service principal access to the secrets in the kay vault via the access policy Then Add the Azure Resource Manager service connection which will be used to access the key vault resource.
upvoted 38 times
AzureJobsTillRetire
1 year, 9 months ago
If this is in AZ-500, the answer is definitely wrong. Not sure if it is right in AZ-400 though. I agree with jeet1985 and app registration is the way to go. When you register the app with Azure AD, the service principle is automatically created for the app, and it can either set for RBAC or access policy via Azure portal. When you create a service principle, you will also have to link it to the app. This step is missing in the given answer. Hence, the given answer is not correct.
upvoted 6 times
...
...
mcabrito
Most Recent 8 months ago
From ChatGPT: To use a secret stored in an Azure Key Vault in an Azure DevOps deployment pipeline, you would typically perform the following actions in sequence: Create a service principal in Azure Active Directory (Azure AD): This service principal will represent the identity that the deployment pipeline will use to access Azure resources, including the Azure Key Vault. Add an app registration in Azure Active Directory (Azure AD): Create an app registration in Azure AD associated with the service principal, which will provide the necessary details for authentication. Configure an access policy in the key vault: Grant the app registration the necessary permissions (like Get or List) on the secrets stored in the Azure Key Vault. So, the correct sequence is: Create a service principal in Azure Active Directory (Azure AD) Add an app registration in Azure Active Directory (Azure AD) Configure an access policy in the key vault
upvoted 1 times
...
varinder82
11 months ago
Final answer after reading all the comments - Provided answer by examtopics is right (Service Principal need to use instead of app registration as app registration only used in web app and here it is not mentioned anywhere )
upvoted 7 times
...
LindyLou
1 year, 3 months ago
You can not directly create a service principle in AzureAD. To create a service principle for your app, you should register the app in Azure AD.
upvoted 1 times
...
Yatoom
1 year, 12 months ago
Couldn't you just let the service principal be created automatically when setting up the Azure Resource Manager service connection?
upvoted 6 times
...
syu31svc
2 years, 2 months ago
Provided answer is correct and provided link supports it
upvoted 1 times
...
Divyayuvi
2 years, 2 months ago
Why not ? 1. Add an Azure Resource Manager service connection to the pipeline 2. Add an app registration in Azure Active Directory (Azure AD) 3. Configure an access policy in the key vault. Anyway in the pipeline we need to connect to the Key Vault through Variable group!
upvoted 2 times
Divyayuvi
2 years, 2 months ago
Sorry, its a typo the 2nd point in the above answer should be 2. "Create a service principal" and not "Add an app registration in Azure Active Directory (Azure AD)"
upvoted 1 times
...
...
Govcomm
2 years, 3 months ago
Service Principal --> Access Policy --> ARM service connection
upvoted 5 times
...
jvyas
2 years, 4 months ago
You can only register app if it is app service. Question doesn't state where the app has been deployed, so SP makes more sense than app registration
upvoted 1 times
...
UnknowMan
2 years, 5 months ago
Create a service principal Give access to KV via access policy (Use the SP created) Add Arm service to pipeline
upvoted 1 times
...
somenkr
2 years, 6 months ago
Answer should be B,C, E There is no way to directly create a service principal using the Azure portal. When you register an application through the Azure portal, an application object and service principal are automatically created in your home directory or tenant.
upvoted 3 times
resonant
1 year, 3 months ago
As lesiris told jeet1985: "It's written nowhere that the portal is mandatory. We can simply create a service principal using the Azure Cli (az ad sp create-for-rbac). So for me the given answer is correct."
upvoted 1 times
resonant
1 year, 3 months ago
My bad. I just discovered this and apparently the application would be automatically created with the Azure CLI command and you'd have to do it with Powershell instead: https://stackoverflow.com/a/71613311/5744858. It seems weird that the behaviour of Azure CLI and Powershell would vary like this. Please someone confirm the StackOverflow post is right and only the Powershell command would create the service principal without creating an app.
upvoted 1 times
...
...
...
shubhb11
2 years, 7 months ago
There is no way to directly create a service principal using the Azure portal. When you register an application through the Azure portal, an application object and service principal are automatically created in your home directory or tenant. https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#app-registration-app-objects-and-service-principals create App registration
upvoted 1 times
resonant
1 year, 3 months ago
You can create a service principal without the Azure Portal and without creating an application first: https://stackoverflow.com/a/71613311/5744858
upvoted 1 times
...
...
rdemontis
2 years, 7 months ago
the answer is correct as demonstrated by the attached documentation
upvoted 2 times
...
lugospod
2 years, 8 months ago
Got this January 2022.
upvoted 3 times
...
[Removed]
2 years, 11 months ago
The App registration is the template used to create the SP. The SP is a security principal (like a User) which can be authenticated and authorised So the most common way of doing this is creating app registration, this is also where you will get a service principal, you use that app/sp for a policy in a key vault, and then as a last step you use this SP in a pipeline
upvoted 1 times
...
ingAlfano
3 years, 3 months ago
when you create a new service connection you create a service principal as well. If you already have service connection you already have a service principal so I don't see the point of creating a service principal here..
upvoted 2 times
ingAlfano
3 years, 3 months ago
Then there is not any clue the app will run on azure so no need to deploy to azure..
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago