FeatureFlagClient class
Client for managing feature flags through the dedicated feature flag endpoint of the Azure App Configuration service.
This requires the 2026-05-01-preview API version or later.
Constructors
| Feature |
Initializes a new instance of the FeatureFlagClient class. |
| Feature |
Initializes a new instance of the FeatureFlagClient class using a TokenCredential. |
Methods
| add |
Adds a feature flag through the dedicated feature flag endpoint, failing if the feature flag already exists. Example usage:
|
| delete |
Delete a feature flag through the dedicated feature flag endpoint. Example usage:
|
| get |
Get a feature flag through the dedicated feature flag endpoint. Example usage:
|
| list |
List revisions of a feature flag through the dedicated feature flag endpoint. Example usage:
|
| list |
List feature flags through the dedicated feature flag endpoint. Example usage:
To conditionally retrieve pages, pass a |
| list |
List the labels used by feature flags through the dedicated feature flag endpoint. Example usage:
|
| set |
Adds or updates a feature flag through the dedicated feature flag endpoint. Example usage:
|
Constructor Details
FeatureFlagClient(string, FeatureFlagClientOptions)
Initializes a new instance of the FeatureFlagClient class.
new FeatureFlagClient(connectionString: string, options?: FeatureFlagClientOptions)
Parameters
- connectionString
-
string
The connection string of the App Configuration service.
- options
- FeatureFlagClientOptions
Options for the FeatureFlagClient.
FeatureFlagClient(string, TokenCredential, FeatureFlagClientOptions)
Initializes a new instance of the FeatureFlagClient class using a TokenCredential.
new FeatureFlagClient(endpoint: string, tokenCredential: TokenCredential, options?: FeatureFlagClientOptions)
Parameters
- endpoint
-
string
The endpoint of the App Configuration service (ex: https://sample.azconfig.io).
- tokenCredential
- TokenCredential
An object that implements the TokenCredential interface used to authenticate requests to the service. Use the @azure/identity package to create a credential that suits your needs.
- options
- FeatureFlagClientOptions
Options for the FeatureFlagClient.
Method Details
addFeatureFlag(FeatureFlagParam, AddFeatureFlagOptions)
Adds a feature flag through the dedicated feature flag endpoint, failing if the feature flag already exists.
Example usage:
import { DefaultAzureCredential } from "@azure/identity";
import { FeatureFlagClient } from "@azure/app-configuration";
const endpoint = "https://example.azconfig.io";
const credential = new DefaultAzureCredential();
const client = new FeatureFlagClient(endpoint, credential);
const result = await client.addFeatureFlag({
name: "MyFeatureFlag",
enabled: true,
});
console.log(`Feature flag ${result.name} is enabled: ${result.enabled}`);
function addFeatureFlag(featureFlag: FeatureFlagParam, options?: AddFeatureFlagOptions): Promise<AddFeatureFlagResponse>
Parameters
- featureFlag
- FeatureFlagParam
The feature flag to add. Its name and label identify the resource.
- options
- AddFeatureFlagOptions
Optional parameters for the request.
Returns
Promise<AddFeatureFlagResponse>
deleteFeatureFlag(FeatureFlagId, DeleteFeatureFlagOptions)
Delete a feature flag through the dedicated feature flag endpoint.
Example usage:
import { DefaultAzureCredential } from "@azure/identity";
import { FeatureFlagClient } from "@azure/app-configuration";
const endpoint = "https://example.azconfig.io";
const credential = new DefaultAzureCredential();
const client = new FeatureFlagClient(endpoint, credential);
await client.deleteFeatureFlag({ name: "MyFeatureFlag" });
function deleteFeatureFlag(id: FeatureFlagId, options?: DeleteFeatureFlagOptions): Promise<DeleteFeatureFlagResponse>
Parameters
The id of the feature flag to delete.
- options
- DeleteFeatureFlagOptions
Optional parameters for the request.
Returns
Promise<DeleteFeatureFlagResponse>
getFeatureFlag(FeatureFlagId, GetFeatureFlagOptions)
Get a feature flag through the dedicated feature flag endpoint.
Example usage:
import { DefaultAzureCredential } from "@azure/identity";
import { FeatureFlagClient } from "@azure/app-configuration";
const endpoint = "https://example.azconfig.io";
const credential = new DefaultAzureCredential();
const client = new FeatureFlagClient(endpoint, credential);
const featureFlag = await client.getFeatureFlag({ name: "MyFeatureFlag" });
console.log(`Feature flag ${featureFlag.name} is enabled: ${featureFlag.enabled}`);
function getFeatureFlag(id: FeatureFlagId, options?: GetFeatureFlagOptions): Promise<GetFeatureFlagResponse>
Parameters
The id of the feature flag to retrieve.
- options
- GetFeatureFlagOptions
Optional parameters for the request.
Returns
Promise<GetFeatureFlagResponse>
listFeatureFlagRevisions(ListFeatureFlagRevisionsOptions)
List revisions of a feature flag through the dedicated feature flag endpoint.
Example usage:
import { DefaultAzureCredential } from "@azure/identity";
import { FeatureFlagClient } from "@azure/app-configuration";
const endpoint = "https://example.azconfig.io";
const credential = new DefaultAzureCredential();
const client = new FeatureFlagClient(endpoint, credential);
for await (const featureFlag of client.listFeatureFlagRevisions({
nameFilter: "MyFeatureFlag",
})) {
console.log(`Revision last modified: ${featureFlag.lastModified}`);
}
function listFeatureFlagRevisions(options?: ListFeatureFlagRevisionsOptions): PagedAsyncIterableIterator<FeatureFlag, ListFeatureFlagRevisionsPage, PageSettings>
Parameters
- options
- ListFeatureFlagRevisionsOptions
Optional parameters for the request.
Returns
listFeatureFlags(ListFeatureFlagsOptions)
List feature flags through the dedicated feature flag endpoint.
Example usage:
import { DefaultAzureCredential } from "@azure/identity";
import { FeatureFlagClient } from "@azure/app-configuration";
const endpoint = "https://example.azconfig.io";
const credential = new DefaultAzureCredential();
const client = new FeatureFlagClient(endpoint, credential);
for await (const featureFlag of client.listFeatureFlags()) {
console.log(`Feature flag: ${featureFlag.name}`);
}
To conditionally retrieve pages, pass a pageEtags array (one etag per page). Each etag is sent
as an If-None-Match header, and unchanged pages are returned as empty pages with their etag
preserved, mirroring AppConfigurationClient.listConfigurationSettings.
function listFeatureFlags(options?: ListFeatureFlagsOptions): PagedAsyncIterableIterator<FeatureFlag, ListFeatureFlagPage, PageSettings>
Parameters
- options
- ListFeatureFlagsOptions
Optional parameters for the request.
Returns
listLabels(ListLabelsOptions)
List the labels used by feature flags through the dedicated feature flag endpoint.
Example usage:
import { DefaultAzureCredential } from "@azure/identity";
import { FeatureFlagClient } from "@azure/app-configuration";
const endpoint = "https://example.azconfig.io";
const credential = new DefaultAzureCredential();
const client = new FeatureFlagClient(endpoint, credential);
for await (const label of client.listLabels()) {
console.log(`Found label: ${label.name}`);
}
function listLabels(options?: ListLabelsOptions): PagedAsyncIterableIterator<SettingLabel, ListLabelsPage, PageSettings>
Parameters
- options
- ListLabelsOptions
Optional parameters for the request.
Returns
setFeatureFlag(FeatureFlagParam, SetFeatureFlagOptions)
Adds or updates a feature flag through the dedicated feature flag endpoint.
Example usage:
import { DefaultAzureCredential } from "@azure/identity";
import { FeatureFlagClient } from "@azure/app-configuration";
const endpoint = "https://example.azconfig.io";
const credential = new DefaultAzureCredential();
const client = new FeatureFlagClient(endpoint, credential);
const result = await client.setFeatureFlag({
name: "MyFeatureFlag",
enabled: true,
});
console.log(`Feature flag ${result.name} is enabled: ${result.enabled}`);
function setFeatureFlag(featureFlag: FeatureFlagParam, options?: SetFeatureFlagOptions): Promise<SetFeatureFlagResponse>
Parameters
- featureFlag
- FeatureFlagParam
The feature flag to add or update. Its name and label identify the resource.
- options
- SetFeatureFlagOptions
Optional parameters for the request.
Returns
Promise<SetFeatureFlagResponse>