-
Notifications
You must be signed in to change notification settings - Fork 77
Update quickstart sample app to use EntraID authentication #1117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
cd02dd8
a4a9b11
0f4f788
09acf6f
3c99923
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||||
| { | ||||||||||
| "dependencies": { | ||||||||||
| "@azure/app-configuration-provider": "latest" | ||||||||||
| "@azure/app-configuration-provider": "latest", | ||||||||||
| "@azure/identity": "latest" | ||||||||||
|
Comment on lines
+3
to
+4
|
||||||||||
| "@azure/app-configuration-provider": "latest", | |
| "@azure/identity": "latest" | |
| "@azure/app-configuration-provider": "^1.0.0", | |
| "@azure/identity": "^3.3.0" |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,10 @@ | |||||||
| <groupId>com.azure.spring</groupId> | ||||||||
| <artifactId>spring-cloud-azure-appconfiguration-config-web</artifactId> | ||||||||
| </dependency> | ||||||||
| <dependency> | ||||||||
| <groupId>com.azure.spring</groupId> | ||||||||
| <artifactId>azure-identity-spring</artifactId> | ||||||||
|
||||||||
| <artifactId>azure-identity-spring</artifactId> | |
| <artifactId>azure-identity-spring</artifactId> | |
| <version>5.14.0</version> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| spring.application.name=QuickStart | ||
| # Either a connection string or endpoint needs to be provided per store. | ||
| # All possible configurations can be found in the [README](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/spring-cloud-azure-starter-appconfiguration-config) | ||
| spring.cloud.azure.appconfiguration.stores[0].connection-string= ${AZURE_APPCONFIG_CONNECTION_STRING} | ||
| spring.cloud.azure.appconfiguration.stores[0].endpoint= ${AZURE_APPCONFIGURATION_ENDPOINT} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,12 +2,13 @@ | |
| load, | ||
| SettingSelector | ||
| ) | ||
| from azure.identity import DefaultAzureCredential | ||
| import os | ||
|
|
||
| connection_string = os.environ.get("AZURE_APPCONFIG_CONNECTION_STRING") | ||
| endpoint = os.environ.get("AZURE_APPCONFIGURATION_ENDPOINT") | ||
|
||
|
|
||
| # Connect to Azure App Configuration using a connection string. | ||
| config = load(connection_string=connection_string) | ||
| # Connect to Azure App Configuration using Microsoft Entra ID authentication. | ||
| config = load(endpoint=endpoint, credential=DefaultAzureCredential()) | ||
|
|
||
| # Find the key "message" and print its value. | ||
| print(config["message"]) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike the .NET example which includes explicit error handling for a missing environment variable, this code will pass undefined to the load function if AZURE_APPCONFIGURATION_ENDPOINT is not set. This could result in unclear error messages for users following the quickstart. Consider adding validation similar to the .NET example to provide a clear error message when the environment variable is not set.