AppConfigurationClient class

Client for the Azure App Configuration service.

Constructors

AppConfigurationClient(string, AppConfigurationClientOptions)

Initializes a new instance of the AppConfigurationClient class.

AppConfigurationClient(string, TokenCredential, AppConfigurationClientOptions)

Initializes a new instance of the AppConfigurationClient class using a TokenCredential.

Methods

addConfigurationSetting(AddConfigurationSettingParam<string> | AddConfigurationSettingParam<FeatureFlagValue> | AddConfigurationSettingParam<SecretReferenceValue>, AddConfigurationSettingOptions)

Add a setting into the Azure App Configuration service, failing if it already exists.

Example usage:

const result = await client.addConfigurationSetting({ key: "MyKey", label: "MyLabel", value: "MyValue" });
archiveSnapshot(string, UpdateSnapshotOptions)

Archive a ready snapshot

Example usage:

const result = await client.archiveSnapshot({name: "MySnapshot"});
beginCreateSnapshot(SnapshotInfo, CreateSnapshotOptions)

Begins creating a snapshot for Azure App Configuration service, fails if it already exists.

beginCreateSnapshotAndWait(SnapshotInfo, CreateSnapshotOptions)

Begins creating a snapshot for Azure App Configuration service, waits until it is done, fails if it already exists.

deleteConfigurationSetting(ConfigurationSettingId, DeleteConfigurationSettingOptions)

Delete a setting from the Azure App Configuration service

Example usage:

const deletedSetting = await client.deleteConfigurationSetting({ key: "MyKey", label: "MyLabel" });
getConfigurationSetting(ConfigurationSettingId, GetConfigurationSettingOptions)

Gets a setting from the Azure App Configuration service.

Example code:

const setting = await client.getConfigurationSetting({ key: "MyKey", label: "MyLabel" });
getSnapshot(string, GetSnapshotOptions)

Get a snapshot from Azure App Configuration service

Example usage:

const result = await client.getSnapshot("MySnapshot");
listConfigurationSettings(ListConfigurationSettingsOptions)

Lists settings from the Azure App Configuration service, optionally filtered by key names, labels and accept datetime.

Example code:

const allSettingsWithLabel = client.listConfigurationSettings({ labelFilter: "MyLabel" });
listConfigurationSettingsForSnapshot(string, ListConfigurationSettingsForSnapshotOptions)

Lists settings from the Azure App Configuration service for snapshots based on name, optionally filtered by key names, labels and accept datetime.

Example code:

const allSettingsWithLabel = client.listConfigurationSettingsForSnashots({ snapshotName: "MySnapshot" });
listLabels(ListLabelsOptions)

Get a list of labels from the Azure App Configuration service

Example code:

const allSettingsWithLabel = client.listLabels({ nameFilter: "prod*" });
listRevisions(ListRevisionsOptions)

Lists revisions of a set of keys, optionally filtered by key names, labels and accept datetime.

Example code:

const revisionsIterator = client.listRevisions({ keys: ["MyKey"] });
listSnapshots(ListSnapshotsOptions)

List all snapshots from Azure App Configuration service

Example usage:

const result = await client.listSnapshots();
recoverSnapshot(string, UpdateSnapshotOptions)

Recover an archived snapshot back to ready status

Example usage:

const result = await client.recoverSnapshot("MySnapshot");
setConfigurationSetting(SetConfigurationSettingParam<string> | SetConfigurationSettingParam<FeatureFlagValue> | SetConfigurationSettingParam<SecretReferenceValue>, SetConfigurationSettingOptions)

Sets the value of a key in the Azure App Configuration service, allowing for an optional etag.

setReadOnly(ConfigurationSettingId, boolean, SetReadOnlyOptions)

Sets or clears a key's read-only status.

updateSyncToken(string)

Adds an external synchronization token to ensure service requests receive up-to-date values.

Constructor Details

AppConfigurationClient(string, AppConfigurationClientOptions)

Initializes a new instance of the AppConfigurationClient class.

new AppConfigurationClient(connectionString: string, options?: AppConfigurationClientOptions)

Parameters

connectionString

string

Connection string needed for a client to connect to Azure.

options
AppConfigurationClientOptions

Options for the AppConfigurationClient.

AppConfigurationClient(string, TokenCredential, AppConfigurationClientOptions)

Initializes a new instance of the AppConfigurationClient class using a TokenCredential.

new AppConfigurationClient(endpoint: string, tokenCredential: TokenCredential, options?: AppConfigurationClientOptions)

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
AppConfigurationClientOptions

Options for the AppConfigurationClient.

Method Details

addConfigurationSetting(AddConfigurationSettingParam<string> | AddConfigurationSettingParam<FeatureFlagValue> | AddConfigurationSettingParam<SecretReferenceValue>, AddConfigurationSettingOptions)

Add a setting into the Azure App Configuration service, failing if it already exists.

Example usage:

const result = await client.addConfigurationSetting({ key: "MyKey", label: "MyLabel", value: "MyValue" });
function addConfigurationSetting(configurationSetting: AddConfigurationSettingParam<string> | AddConfigurationSettingParam<FeatureFlagValue> | AddConfigurationSettingParam<SecretReferenceValue>, options?: AddConfigurationSettingOptions): Promise<AddConfigurationSettingResponse>

Parameters

options
AddConfigurationSettingOptions

Optional parameters for the request.

Returns

archiveSnapshot(string, UpdateSnapshotOptions)

Archive a ready snapshot

Example usage:

const result = await client.archiveSnapshot({name: "MySnapshot"});
function archiveSnapshot(name: string, options?: UpdateSnapshotOptions): Promise<UpdateSnapshotResponse>

Parameters

name

string

The name of the snapshot.

options
UpdateSnapshotOptions

Optional parameters for the request.

Returns

beginCreateSnapshot(SnapshotInfo, CreateSnapshotOptions)

Begins creating a snapshot for Azure App Configuration service, fails if it already exists.

function beginCreateSnapshot(snapshot: SnapshotInfo, options?: CreateSnapshotOptions): Promise<SimplePollerLike<OperationState<CreateSnapshotResponse>, CreateSnapshotResponse>>

Parameters

snapshot
SnapshotInfo

Returns

Promise<@azure/core-lro.SimplePollerLike<OperationState<CreateSnapshotResponse>, CreateSnapshotResponse>>

beginCreateSnapshotAndWait(SnapshotInfo, CreateSnapshotOptions)

Begins creating a snapshot for Azure App Configuration service, waits until it is done, fails if it already exists.

function beginCreateSnapshotAndWait(snapshot: SnapshotInfo, options?: CreateSnapshotOptions): Promise<CreateSnapshotResponse>

Parameters

snapshot
SnapshotInfo

Returns

deleteConfigurationSetting(ConfigurationSettingId, DeleteConfigurationSettingOptions)

Delete a setting from the Azure App Configuration service

Example usage:

const deletedSetting = await client.deleteConfigurationSetting({ key: "MyKey", label: "MyLabel" });
function deleteConfigurationSetting(id: ConfigurationSettingId, options?: DeleteConfigurationSettingOptions): Promise<DeleteConfigurationSettingResponse>

Parameters

id
ConfigurationSettingId

The id of the configuration setting to delete.

options
DeleteConfigurationSettingOptions

Optional parameters for the request (ex: etag, label)

Returns

getConfigurationSetting(ConfigurationSettingId, GetConfigurationSettingOptions)

Gets a setting from the Azure App Configuration service.

Example code:

const setting = await client.getConfigurationSetting({ key: "MyKey", label: "MyLabel" });
function getConfigurationSetting(id: ConfigurationSettingId, options?: GetConfigurationSettingOptions): Promise<GetConfigurationSettingResponse>

Parameters

id
ConfigurationSettingId

The id of the configuration setting to get.

options
GetConfigurationSettingOptions

Optional parameters for the request.

Returns

getSnapshot(string, GetSnapshotOptions)

Get a snapshot from Azure App Configuration service

Example usage:

const result = await client.getSnapshot("MySnapshot");
function getSnapshot(name: string, options?: GetSnapshotOptions): Promise<GetSnapshotResponse>

Parameters

name

string

The name of the snapshot.

options
GetSnapshotOptions

Optional parameters for the request.

Returns

listConfigurationSettings(ListConfigurationSettingsOptions)

Lists settings from the Azure App Configuration service, optionally filtered by key names, labels and accept datetime.

Example code:

const allSettingsWithLabel = client.listConfigurationSettings({ labelFilter: "MyLabel" });
function listConfigurationSettings(options?: ListConfigurationSettingsOptions): PagedAsyncIterableIterator<ConfigurationSetting<string>, ListConfigurationSettingPage, PageSettings>

Parameters

options
ListConfigurationSettingsOptions

Optional parameters for the request.

Returns

listConfigurationSettingsForSnapshot(string, ListConfigurationSettingsForSnapshotOptions)

Lists settings from the Azure App Configuration service for snapshots based on name, optionally filtered by key names, labels and accept datetime.

Example code:

const allSettingsWithLabel = client.listConfigurationSettingsForSnashots({ snapshotName: "MySnapshot" });
function listConfigurationSettingsForSnapshot(snapshotName: string, options?: ListConfigurationSettingsForSnapshotOptions): PagedAsyncIterableIterator<ConfigurationSetting<string>, ListConfigurationSettingPage, PageSettings>

Parameters

snapshotName

string

options
ListConfigurationSettingsForSnapshotOptions

Optional parameters for the request.

Returns

listLabels(ListLabelsOptions)

Get a list of labels from the Azure App Configuration service

Example code:

const allSettingsWithLabel = client.listLabels({ nameFilter: "prod*" });
function listLabels(options?: ListLabelsOptions): PagedAsyncIterableIterator<SettingLabel, ListLabelsPage, PageSettings>

Parameters

options
ListLabelsOptions

Optional parameters for the request.

Returns

listRevisions(ListRevisionsOptions)

Lists revisions of a set of keys, optionally filtered by key names, labels and accept datetime.

Example code:

const revisionsIterator = client.listRevisions({ keys: ["MyKey"] });
function listRevisions(options?: ListRevisionsOptions): PagedAsyncIterableIterator<ConfigurationSetting<string>, ListRevisionsPage, PageSettings>

Parameters

options
ListRevisionsOptions

Optional parameters for the request.

Returns

listSnapshots(ListSnapshotsOptions)

List all snapshots from Azure App Configuration service

Example usage:

const result = await client.listSnapshots();
function listSnapshots(options?: ListSnapshotsOptions): PagedAsyncIterableIterator<ConfigurationSnapshot, ListSnapshotsPage, PageSettings>

Parameters

options
ListSnapshotsOptions

Optional parameters for the request.

Returns

recoverSnapshot(string, UpdateSnapshotOptions)

Recover an archived snapshot back to ready status

Example usage:

const result = await client.recoverSnapshot("MySnapshot");
function recoverSnapshot(name: string, options?: UpdateSnapshotOptions): Promise<UpdateSnapshotResponse>

Parameters

name

string

The name of the snapshot.

options
UpdateSnapshotOptions

Optional parameters for the request.

Returns

setConfigurationSetting(SetConfigurationSettingParam<string> | SetConfigurationSettingParam<FeatureFlagValue> | SetConfigurationSettingParam<SecretReferenceValue>, SetConfigurationSettingOptions)

Sets the value of a key in the Azure App Configuration service, allowing for an optional etag.

function setConfigurationSetting(configurationSetting: SetConfigurationSettingParam<string> | SetConfigurationSettingParam<FeatureFlagValue> | SetConfigurationSettingParam<SecretReferenceValue>, options?: SetConfigurationSettingOptions): Promise<SetConfigurationSettingResponse>

Parameters

options
SetConfigurationSettingOptions

Optional parameters for the request.

Example code:

await client.setConfigurationSetting({ key: "MyKey", value: "MyValue" });

Returns

setReadOnly(ConfigurationSettingId, boolean, SetReadOnlyOptions)

Sets or clears a key's read-only status.

function setReadOnly(id: ConfigurationSettingId, readOnly: boolean, options?: SetReadOnlyOptions): Promise<SetReadOnlyResponse>

Parameters

id
ConfigurationSettingId

The id of the configuration setting to modify.

readOnly

boolean

Returns

updateSyncToken(string)

Adds an external synchronization token to ensure service requests receive up-to-date values.

function updateSyncToken(syncToken: string)

Parameters

syncToken

string

The synchronization token value.