exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 4 question 62 discussion

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

HOTSPOT -

You are a developer building a web site using a web app. The web site stores configuration data in Azure App Configuration.

Access to Azure App Configuration has been configured to use the identity of the web app for authentication. Security requirements specify that no other authentication systems must be used.

You need to load configuration data from Azure App Configuration.

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

NOTE: Each correct selection is worth one point.

Show Suggested Answer Hide Answer
Suggested Answer:

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
Taschiloge
Highly Voted 2 years, 3 months ago
I think it should be ManagedIdentityCredential: ManagedIdentityCredential: attempts to authenticate using a managed identity that is assigned to the deployment environment (if any). DefaultAzureCredential can not be, since only one type of authentication is allowed. ChainedTokenCredential could work if there is only one authentication type is specified in code. Source: https://yourazurecoach.com/2020/08/13/managed-identity-simplified-with-the-new-azure-net-sdks/
upvoted 27 times
florianwicher
3 months ago
Agree, the paragraph "Access to Azure App Configuration has been configured to use the identity of the web app for authentication. Security requirements specify that no other authentication systems must be used." is there to coax us into not picking DefaultAzureCredential.
upvoted 1 times
...
tarek0811
1 year, 9 months ago
chatgpt generated code with ManagedIdentityCredential
upvoted 2 times
maggo04
10 months, 2 weeks ago
Don't post answer from chatgpt at least you validate it, because It is not 100% accurate
upvoted 8 times
...
...
adilkhan
2 years, 3 months ago
from azure.identity import DefaultAzureCredential from azure.appconfiguration import AzureAppConfigurationClient credential = DefaultAzureCredential() client = AzureAppConfigurationClient(base_url="your_endpoint_url", credential=credential)
upvoted 7 times
Jay456
6 months, 3 weeks ago
I disagree. DefaultAzureCredential allows other auth methods as well, for instance when developing locally. Only ManagedIdentityCredential ensures only the identity of the app can be used for authentication
upvoted 3 times
...
...
SharpZx
2 years, 1 month ago
I think it should be DefaultAzureCredential. Check DefaultAzureCredential section at https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python DefaultAzureCredential is appropriate for most applications which will run in the Azure Cloud because it combines common production credentials with development credentials Managed Identity - If the application is deployed to an Azure host with Managed Identity enabled, DefaultAzureCredential will authenticate with it.
upvoted 2 times
JamieS
2 years, 1 month ago
I disagree, if they used options (https://docs.microsoft.com/en-us/dotnet/api/azure.identity.defaultazurecredentialoptions?view=azure-dotnet-preview) they could exclude unwanted auth methods, but it's not in the code. Otherwise "It is not always clear what authentication method got executed". Question states that "configured to use the identity" so I think it's ManagedIdentityCredential in place of azure default.
upvoted 5 times
SharpZx
2 years, 1 month ago
JamieS you are right. It should be ManagedIdentityCredential. I overlooked .. "Security requirements specify that no other authentication systems must be used".
upvoted 4 times
...
...
...
...
EricPerezVillar
Highly Voted 2 years ago
Answer is correct. It is here: https://learn.microsoft.com/en-us/python/api/overview/azure/appconfiguration-readme?view=azure-python#create-a-client
upvoted 19 times
fuji36850
1 year ago
It works, but does not meet question requirements because DefaultAzureCredential will try other auth methods too
upvoted 3 times
...
MikeAWS
1 year, 6 months ago
great catch! thanks
upvoted 1 times
...
...
Christian_garcia_martin
Most Recent 9 months, 2 weeks ago
Correct Answer : 1 ManagedIdentityCredential 2 ConfigurationClient 3 ManagedIdentityCredential 4 ConfigurationClient
upvoted 1 times
...
130nk3r5
1 year, 4 months ago
ManagedIdentityCredential > AddAzureAppconfig > ManagedIdentityCredential > AdAzureAppConf
upvoted 5 times
...
Weam
1 year, 5 months ago
ManagedIdentityCredential according to the following link : https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.managedidentitycredential?view=azure-python We use ManagedIdentityCredential with apps or resources that support ManagedIdentityCredential.
upvoted 1 times
...
Ciupaz
1 year, 7 months ago
This question is not updated with the latest Microsoft docs. The 2nd and 4th answers are not correct, and are not present in DDL. Here the right Python code: from azure.identity import DefaultAzureCredential from azure.appconfiguration import AzureAppConfigurationClient credential = DefaultAzureCredential() client = AzureAppConfigurationClient(base_url="your_endpoint_url", credential=credential) https://learn.microsoft.com/en-us/python/api/overview/azure/appconfiguration-readme?view=azure-python#create-a-client
upvoted 3 times
...
macobuzi
1 year, 8 months ago
And why the hell did Microsoft decide to include Python code in the exam?
upvoted 4 times
...
EliteAllen
1 year, 9 months ago
To load configuration data from Azure App Configuration using the identity of the web app for authentication, you would typically use the ManagedIdentityCredential class for authentication. Here's how you should complete the code: from azure.identity import ManagedIdentityCredential from azure.appconfiguration import AzureAppConfigurationClient credential = ManagedIdentityCredential() client = AzureAppConfigurationClient(base_url="your_endpoint_url", credential=credential)
upvoted 8 times
...
nickk6425
1 year, 10 months ago
Should be ManagedIdentity because "...configured to use the identity of the web app for authentication. Security requirements specify that no other authentication systems must be used."
upvoted 4 times
nickk6425
1 year, 10 months ago
DefaultAzureCredentials will try different authentication, ie. it will use AZ, Visual Studio, ManagedIdentity, and so on until one succeeds
upvoted 3 times
...
...
Dats1987
2 years ago
Note that the DefaultAzureCredential is used to authenticate using the identity of the web app. This credential provider tries multiple authentication methods (e.g. environment variables, Azure Managed Identity, Azure CLI) until it finds a suitable one. In this way, you can ensure that no other authentication systems are used Above ans are correct.
upvoted 1 times
...
Dilmurod
2 years, 1 month ago
It should be ManagedIdentityCredential. Managed identity authentication is supported via either the DefaultAzureCredential or the ManagedIdentityCredential directly for the following Azure services: Example: from azure.identity import ManagedIdentityCredential from azure.keyvault.secrets import SecretClient credential = ManagedIdentityCredential() client = SecretClient("https://my-vault.vault.azure.net", credential) Reference: https://github.com/Azure/azure-sdk-for-python/tree/azure-appconfiguration_1.4.0/sdk/identity/azure-identity
upvoted 2 times
...
naivecoder786
2 years, 2 months ago
Correct one is ManagedIdentityCredential 110% Sure !
upvoted 3 times
[Removed]
2 years, 1 month ago
Can you explain please?
upvoted 1 times
...
...
adilkhan
2 years, 3 months ago
The options are wrong https://learn.microsoft.com/en-us/python/api/overview/azure/appconfiguration-readme?view=azure-python from azure.identity import DefaultAzureCredential from azure.appconfiguration import AzureAppConfigurationClient credential = DefaultAzureCredential() client = AzureAppConfigurationClient(base_url="your_endpoint_url", credential=credential)
upvoted 3 times
ajayasa
2 years, 3 months ago
@adilkhan can you please provide right answers. your comment starts with answers being wrong and you are providing the same answers mentioned
upvoted 6 times
maiwufsiorn
2 years, 3 months ago
No, he is not. Read it again: AzureAppConfigurationClient is different from AddAzureAppConfiguration.
upvoted 2 times
warchoon
2 years, 2 months ago
It looks like typo. AddAzureAppConfiguration is a method, not object.
upvoted 1 times
...
...
...
...
g2000
2 years, 3 months ago
DefaultAzureCredential is wrong because it tries different authentication methods. https://yourazurecoach.com/2020/08/13/managed-identity-simplified-with-the-new-azure-net-sdks/
upvoted 5 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