Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/QuickStart/DotNet/QuickStartApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
using Microsoft.Extensions.Configuration;
using Azure.Identity;

Uri endpoint = new(Environment.GetEnvironmentVariable("AZURE_APPCONFIGURATION_ENDPOINT") ??
throw new InvalidOperationException("The environment variable 'AZURE_APPCONFIGURATION_ENDPOINT' is not set or is empty."));

var builder = new ConfigurationBuilder();
builder.AddAzureAppConfiguration(options =>
{
options.Connect(Environment.GetEnvironmentVariable("AZURE_APPCONFIG_CONNECTION_STRING"))
options.Connect(endpoint, new DefaultAzureCredential())
.Select("QuickStartApp*");
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.14.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="6.0.1" />
</ItemGroup>

Expand Down
8 changes: 5 additions & 3 deletions examples/QuickStart/JavaScript/QuickStartApp/QuickStartApp.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const { load } = require("@azure/app-configuration-provider");
const connectionString = process.env.AZURE_APPCONFIG_CONNECTION_STRING;
const { DefaultAzureCredential } = require("@azure/identity");

const endpoint = process.env.AZURE_APPCONFIGURATION_ENDPOINT;

async function run() {
console.log("Sample 1: Load key-values with default selector");

// Connect to Azure App Configuration using a connection string and load all key-values with null label.
const settings = await load(connectionString);
// Connect to Azure App Configuration using EntraID authentication and load all key-values with null label.
const settings = await load(endpoint, new DefaultAzureCredential());

console.log("---Consume configuration as a Map---");
// Find the key "message" and print its value.
Expand Down
3 changes: 2 additions & 1 deletion examples/QuickStart/JavaScript/QuickStartApp/package.json
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"
}
}
4 changes: 4 additions & 0 deletions examples/QuickStart/JavaSpring/QuickStart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
</dependency>
</dependencies>

<dependencyManagement>
Expand Down
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}
7 changes: 4 additions & 3 deletions examples/QuickStart/Python/QuickStartApp/QuickStartApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link

Copilot AI Dec 12, 2025

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 silently pass None 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.

Copilot uses AI. Check for mistakes.

# Connect to Azure App Configuration using a connection string.
config = load(connection_string=connection_string)
# Connect to Azure App Configuration using EntraID authentication.
config = load(endpoint=endpoint, credential=DefaultAzureCredential())

# Find the key "message" and print its value.
print(config["message"])
Loading