@zuke/az
`@zuke/az` — typed Azure CLI tasks, readers, and a canary platform and analysis.
@zuke/az on JSR ↗ 71 symbols
Symbols
type AzAccessTokenResourceType = oss-rdbms | arm | aad-graph | ms-graph | batch | media | data-lake The well-known resources get-access-token --resource-type accepts.
class AzAccountGetAccessTokenSettings extends AzSettings Settings for az account get-access-token.
The answer is a bearer token, so the command always runs quietly — captured, never streamed — with --output json pinned whatever the settings or the user's config say, and the token is registered with the run's redactor once it returns.
| Member | Signature | Doc |
|---|---|---|
resource | resource(uri: string): this | The resource the token is for, as a Microsoft Entra v1.0 endpoint (--resource). |
resourceType | resourceType(type: AzAccessTokenResourceType): this | A well-known resource the token is for (--resource-type). |
scope | scope(...scopes: string[]): this | Microsoft Entra v2.0 scopes for the token (--scope); repeatable. |
tenant | tenant(tenant: string): this | The tenant to get the token from (--tenant). |
class AzAccountListSettings extends AzSettings Settings for az account list.
| Member | Signature | Doc |
|---|---|---|
all | all(): this | Include subscriptions from every cloud and in every state (--all). |
refresh | refresh(): this | Read the subscriptions from the server, not the cache (--refresh). |
class AzAccountSetSettings extends AzSettings Settings for az account set: make a subscription the default. Name it with the global .subscription(nameOrId), which account set requires.
class AzAccountShowSettings extends AzSettings Settings for az account show: the current (or the given) subscription.
class AzAcrBuildSettings extends AzSettings Settings for az acr build: build an image in the registry from a local directory, a git URL or a tarball, and push it.
--build-arg values are visible to the ACR team for debugging, as the CLI warns; pass a credential with secretBuildArg, whose value is also registered with the run's redactor.
| Member | Signature | Doc |
|---|---|---|
registry | registry(name: string): this | The registry to build in (--registry). |
source | source(location: string): this | The build context: a directory, a git URL or a tarball URL (the positional source). |
image | image(nameAndTag: string): this | A name:tag to give the image (--image); repeatable. |
file | file(path: string): this | The Dockerfile, relative to the source (--file). |
buildArg | buildArg(name: string, value: string): this | A build argument (--build-arg name=value); repeatable. Never a credential. |
secretBuildArg | secretBuildArg(name: string, value: string): this | A build argument the ACR team does not see (--secret-build-arg name=value); repeatable. The value is registered with the run's redactor; it is still part of the argv. |
platform | platform(platform: string): this | The platform to build for (--platform), e.g. "linux/arm64". |
target | target(stage: string): this | The Dockerfile stage to build (--target). |
timeout | timeout(seconds: number): this | The build's timeout in seconds (--timeout). |
resourceGroup | resourceGroup(name: string): this | The registry's resource group (--resource-group). |
noPush | noPush(): this | Build without pushing (--no-push). |
noLogs | noLogs(): this | Do not stream the build's logs (--no-logs). |
noWait | noWait(): this | Return once the build is queued (--no-wait). |
class AzAcrLoginSettings extends AzSettings Settings for az acr login.
Without exposeToken the CLI logs the local Docker client in itself. With it, the CLI prints a registry refresh token instead — for docker login with the user 00000000-0000-0000-0000-000000000000 — so the command always runs quietly with --output json pinned, and the token is registered with the run's redactor once it returns.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | The registry's name (--name). |
exposeToken | exposeToken(): this | Print a token instead of logging Docker in (--expose-token). |
username | username(name: string): this | A registry user, instead of the signed-in identity (--username). |
password | password(secret: string): this | The registry user's password (--password), sent on standard input as --password=@- so it never enters the argv, and registered with the run's redactor. |
suffix | suffix(suffix: string): this | The tenant suffix of the registry's login server (--suffix). |
class AzAcrRepositoryDeleteSettings extends AzSettings Settings for az acr repository delete: one image, by tag or digest, or a whole repository. The CLI asks for confirmation unless yes is set.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | The registry's name (--name). |
image | image(image: string): this | The image to delete, repo:tag or repo@digest (--image). |
repository | repository(name: string): this | Delete the whole repository, every tag in it (--repository). |
yes | yes(): this | Delete without asking (--yes). |
class AzAcrRepositoryShowTagsSettings extends AzSettings Settings for az acr repository show-tags.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | The registry's name (--name). |
repository | repository(name: string): this | The repository whose tags to list (--repository). |
top | top(count: number): this | At most this many tags (--top). |
orderby | orderby(order: time_asc | time_desc): this | Order by time, oldest or newest first (--orderby); by name otherwise. |
detail | detail(): this | Each tag's details, not only its name (--detail). |
class AzAksGetCredentialsSettings extends AzResourceSettings Settings for az aks get-credentials. The credentials go to a file — ~/.kube/config unless file says otherwise. Printing them (--file -) would put a cluster credential in the build log, so a - is refused.
| Member | Signature | Doc |
|---|---|---|
admin | admin(): this | Get the cluster-admin credentials (--admin). |
file | file(path: string): this | The kubeconfig file to write (--file); ~/.kube/config by default. |
overwriteExisting | overwriteExisting(): this | Replace an existing entry of the same name (--overwrite-existing). |
context | context(name: string): this | The context name to write, instead of the cluster's (--context). |
publicFqdn | publicFqdn(): this | Point the kubeconfig at the cluster's public FQDN (--public-fqdn). |
format | format(format: azure | exec): this | The credential format (--format): azure or exec (kubelogin). |
class AzAksShowSettings extends AzResourceSettings Settings for az aks show.
class AzContainerAppCanary An Azure container app as a canary platform. Create one with containerAppCanary; hand it to @zuke/canary's c.platform(...).
Exposure is a share of the app's ingress traffic, set exactly, in whole percents.
| Member | Signature | Doc |
|---|---|---|
describe | describe(): string | "container app api", for the build summary. |
stage | stage(ctx: AzContainerAppCanaryContext): Promise<void> | Read the app, pin all of its traffic to the revision serving it by name — so the new revision cannot inherit "latest" routing — deploy the candidate image as a new revision, and record the rollout: the app, resource group and az flags every later call is checked against, the app's resource id, the stable and candidate revisions, and whether the traffic followed the latest revision before. Before the pin it records the app, resource group and flags, the app's id, the stable revision and whether the traffic followed the latest revision, so a stage run again checks against them, and the rollback of a stage that fails can hand the traffic back to "latest". Refuses an app that is not in multiple-revision mode, one without ingress, one whose traffic is already split or carries labels, one whose traffic follows the latest revision while its newest revision has not provisioned, a deploy that made no new revision, a latest revision other than the one .revisionSuffix(...) names, and a candidate that did not provision. A stage run again over a record of the same rollout checks it and changes nothing. |
expose | expose(percent: number, ctx: AzContainerAppCanaryContext): Promise<number> | Send percent of the app's traffic to the candidate revision and the rest to the stable one, by name. First the configuration is compared with the record; then the app is read, and this refuses — changing nothing — unless it is still the app staged, its traffic still goes only to the stable revision and the candidate, and the candidate is still the revision staged. |
promote | promote(ctx: AzContainerAppCanaryContext): Promise<void> | Send all traffic to the candidate — after checking, as expose does, the record, the app's id, the split and the candidate, and that the candidate is still the app's latest revision. Traffic that followed the latest revision before the rollout is handed back to "latest"; otherwise the candidate is pinned by name. An app already serving only the candidate that way is left as it is, so a promote run again changes nothing. |
abort | abort(ctx: AzContainerAppCanaryContext): Promise<void> | Send all traffic back to the stable revision, by name. Idempotent. What it does depends on what this rollout recorded: - The rollout is staged (a rollback mid-rollout, or after a promote): once the configuration and the app's id match the record, the stable revision gets 100 % and the candidate 0 %. Traffic that also goes to a third revision is a newer rollout, and this refuses rather than undo it too. The traffic stays pinned to the stable revision by name, even if it followed "latest" before: the latest revision is the candidate now. - stage failed before recording it: the candidate never had any traffic. Traffic that followed the latest revision and was pinned to the stable one by name is handed back to "latest" — once the configuration and the app's id match the pin, the traffic still goes only to the stable revision, and that is still the newest revision. Otherwise it is left pinned, and the summary says so. - Any other stage marker: the record is damaged, and this refuses. - Nothing recorded, on a rollback (ctx.reason is "rollback"): nothing was staged, so nothing runs — the stable revision is not even read. - Nothing recorded, run by hand (rollout.abort on its own, a fresh run, or an engine that names no reason): all traffic goes to the revision set with AzContainerAppCanarySettings.stable. Without one this refuses. |
exposure | exposure: traffic | Container Apps splits requests, so exposure is a traffic share. |
interface AzContainerAppCanaryContext The part of the canary engine's context the Container Apps platform uses: the rollout's durable state, where the staged revisions are recorded, and the build summary. The engine hands a richer context; this is the narrow view.
| Member | Signature | Doc |
|---|---|---|
reportSummary | reportSummary(pairs: SummaryPairs): void | Add key/value pairs to the calling target's row in the build summary. |
state | state: TargetStateHandle | The rollout's durable platform state, shared by every call. |
reason? | reason?: rollback | hand-run | Why abort runs: "rollback" when the engine undoes a rollout, "hand-run" for rollout.abort run on its own. An engine older than this field leaves it out, which is treated as a hand run — the behaviour from before the field existed. |
class AzContainerAppCanarySettings How containerAppCanary reaches the app and deploys the candidate, configured through its lambda.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | The container app to roll out to. It must already exist. |
resourceGroup | resourceGroup(name: string): this | The resource group the app is in. |
image | image(reference: string): this | The candidate's container image, deployed by stage. |
containerName | containerName(name: string): this | The container the image is for, when the app has several (--container-name). |
revisionSuffix | revisionSuffix(suffix: string): this | A suffix for the candidate revision's name (--revision-suffix), so it is <app>--<suffix>. It must be new to the app. |
stable | stable(revision: string): this | The revision to send all traffic to when rollout.abort is run by hand. Such a run is fresh, with no record of a rollout, so it has nothing else to go on. A rollback the engine runs mid-rollout does not use it: that one returns the traffic to the revision stage recorded. |
az | az(configure: Configure<AzSettings>): this | Global options for every command the platform runs — (z) => z.subscription("prod"), a .toolPath(...), or a .runner(...), the seam a test answers through. The flags it gives are recorded in the rollout's state, which is plain JSON: never pass a secret on the command line here. A reader's --output and --query are its own and are set after it. |
name_? | name_?: string | The container app (set by name). |
resourceGroup_? | resourceGroup_?: string | Its resource group (set by resourceGroup). |
image_? | image_?: string | The candidate's container image (set by image). |
containerName_? | containerName_?: string | The container the image is for (set by containerName). |
revisionSuffix_? | revisionSuffix_?: string | A suffix for the candidate revision's name (set by revisionSuffix). |
stable_? | stable_?: string | The revision a hand-run rollback returns to (set by stable). |
az_ | az_: Configure<AzSettings> | Global options for every command (set by az). |
class AzContainerappIngressTrafficSetSettings extends AzResourceSettings Settings for az containerapp ingress traffic set: the share of traffic each revision — or each label — receives. The weights must add up to 100; the CLI checks.
| Member | Signature | Doc |
|---|---|---|
revisionWeight | revisionWeight(revision: string, weight: number): this | A revision's share of traffic, in percent (--revision-weight revision=weight); repeatable. "latest" is the newest revision. |
labelWeight | labelWeight(label: string, weight: number): this | A label's share of traffic, in percent (--label-weight label=weight); repeatable. |
class AzContainerappRevisionListSettings extends AzResourceSettings Settings for az containerapp revision list.
| Member | Signature | Doc |
|---|---|---|
all | all(): this | Include inactive revisions (--all). |
class AzContainerappRevisionSettings extends AzResourceSettings Settings for az containerapp revision activate and deactivate: the app, and the revision to switch.
| Member | Signature | Doc |
|---|---|---|
revision | revision(name: string): this | The revision to activate or deactivate (--revision). |
class AzContainerappShowSettings extends AzResourceSettings Settings for az containerapp show. Secrets stay out: --show-secrets is not typed.
class AzContainerappUpdateSettings extends AzResourceSettings Settings for az containerapp update: a new image, environment or scale, which makes a new revision.
| Member | Signature | Doc |
|---|---|---|
image | image(image: string): this | The container image (--image), e.g. "myregistry.azurecr.io/api:1.4.0". |
containerName | containerName(name: string): this | The container to update, when the app has several (--container-name). |
revisionSuffix | revisionSuffix(suffix: string): this | A suffix for the new revision's name (--revision-suffix). |
setEnvVar | setEnvVar(name: string, value: string): this | Add or update an environment variable (--set-env-vars name=value); repeatable. A value of secretref:<secret> reads one of the app's secrets. |
removeEnvVars | removeEnvVars(...names: string[]): this | Remove environment variables (--remove-env-vars); repeatable. |
cpu | cpu(cores: number): this | CPU cores for the container (--cpu), e.g. 0.5. |
memory | memory(amount: string): this | Memory for the container (--memory), e.g. "1.0Gi". |
minReplicas | minReplicas(count: number): this | The fewest replicas (--min-replicas). |
maxReplicas | maxReplicas(count: number): this | The most replicas (--max-replicas). |
yaml | yaml(path: string): this | Take the whole configuration from a YAML file (--yaml); other options are ignored. |
class AzDeploymentGroupCreateSettings extends AzDeploymentGroupTemplateSettings Settings for az deployment group create.
| Member | Signature | Doc |
|---|---|---|
noWait | noWait(): this | Return once the deployment has started (--no-wait). |
class AzDeploymentGroupShowSettings extends AzResourceSettings Settings for az deployment group show.
class AzDeploymentGroupTemplateSettings extends AzResourceSettings The template, parameters and mode a deploying deployment group command shares — create and what-if read them identically. The deployment's --name is optional here; the CLI defaults it to the template file's name.
| Member | Signature | Doc |
|---|---|---|
templateFile | templateFile(path: string): this | A local ARM template or Bicep file (--template-file). |
templateUri | templateUri(uri: string): this | A template at a URL (--template-uri). |
templateSpec | templateSpec(id: string): this | A template spec, by resource id (--template-spec). |
parametersFile | parametersFile(path: string): this | A parameters file — JSON or .bicepparam (--parameters <path>); repeatable, later values winning. |
parameter | parameter(name: string, value: string | number | boolean): this | One parameter (--parameters name=value); repeatable. The value is converted to the type the template declares. It is part of the argv, so a secure value belongs in a parameters file or a Key Vault reference. |
mode | mode(mode: AzDeploymentMode): this | Incremental (the default) or Complete, which deletes what the template omits (--mode). |
class AzDeploymentGroupWhatIfSettings extends AzDeploymentGroupTemplateSettings Settings for az deployment group what-if: what a deployment would change.
| Member | Signature | Doc |
|---|---|---|
resultFormat | resultFormat(format: FullResourcePayloads | ResourceIdOnly): this | How much of each change to show (--result-format). |
excludeChangeTypes | excludeChangeTypes(...types: AzWhatIfChangeType[]): this | Leave these kinds of change out (--exclude-change-types); repeatable. |
noPrettyPrint | noPrettyPrint(): this | Print the result as JSON rather than the formatted diff (--no-pretty-print). |
type AzDeploymentMode = Incremental | Complete How a deployment treats resources the template does not mention (--mode).
type AzForceDeletionType = Microsoft.Compute/virtualMachines | Microsoft.Compute/virtualMachineScaleSets | Microsoft.Databricks/workspaces The resource types group delete --force-deletion-types accepts.
class AzFunctionappDeploymentSourceConfigZipSettings extends AzResourceSettings Settings for az functionapp deployment source config-zip: deploy a zip package to a function app. This is the generally available command; az functionapp deploy is still in preview.
| Member | Signature | Doc |
|---|---|---|
src | src(path: string): this | The zip package (--src). |
buildRemote | buildRemote(value: boolean): this | Build the package on the service — install dependencies there (--build-remote). |
timeout | timeout(seconds: number): this | How long to wait for the deployment's status, in seconds (--timeout). |
slot | slot(name: string): this | A slot instead of production (--slot). |
class AzGroupCreateSettings extends AzSettings Settings for az group create.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | The resource group's name (--name). |
location | location(location: string): this | The region to create it in (--location), e.g. "westeurope". |
tag | tag(key: string, value: string): this | A tag (--tags key=value); repeatable. |
managedBy | managedBy(id: string): this | The id of the resource that manages the group (--managed-by). |
class AzGroupDeleteSettings extends AzSettings Settings for az group delete. The CLI asks for confirmation unless yes is set — and fails, without a terminal to ask on.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | The resource group's name (--name). |
yes | yes(): this | Delete without asking (--yes). |
noWait | noWait(): this | Return once the deletion has started (--no-wait). |
forceDeletionTypes | forceDeletionTypes(type: AzForceDeletionType): this | Force-delete the group's resources of this type (--force-deletion-types). |
class AzGroupExistsSettings extends AzSettings Settings for az group exists, which prints true or false.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | The resource group's name (--name). |
class AzGroupShowSettings extends AzSettings Settings for az group show.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | The resource group's name (--name). |
type AzKeyvaultSecretEncoding = utf-8 | utf-16le | utf-16be | ascii | base64 | hex The encodings keyvault secret set --encoding accepts for a file.
class AzKeyvaultSecretSetSettings extends AzSettings Settings for az keyvault secret set.
The value comes from a file — read exactly, with its encoding — or from value, which is sent on standard input as --value=@- so it never enters the argv. The CLI strips trailing line breaks from what it reads that way; use a file for a value that must keep them.
| Member | Signature | Doc |
|---|---|---|
vaultName | vaultName(name: string): this | The vault's name (--vault-name). |
name | name(name: string): this | The secret's name (--name). |
value | value(secret: string): this | The value, sent on standard input as --value=@- and registered with the run's redactor. |
file | file(path: string): this | Read the value from a file (--file) — the way to keep it exact. |
encoding | encoding(encoding: AzKeyvaultSecretEncoding): this | How the file is encoded (--encoding); utf-8 by default. Refused without a file: the CLI saves it as a file-encoding tag that keyvault secret download later decodes with. |
contentType | contentType(type: string): this | What the value is, e.g. "password" (--content-type). |
expires | expires(time: AzTime): this | When the secret expires (--expires): a Date, or a string such as 2027-01-01T00:00:00Z — the CLI takes UTC to the second, no fractions. |
notBefore | notBefore(time: AzTime): this | When the secret becomes usable (--not-before), in the same form as expires. |
disabled | disabled(value: boolean): this | Create the secret disabled, or enabled (--disabled). |
tag | tag(key: string, value: string): this | A tag (--tags key=value); repeatable. |
class AzKeyvaultSecretShowSettings extends AzSettings Settings for az keyvault secret show.
| Member | Signature | Doc |
|---|---|---|
vaultName | vaultName(name: string): this | The vault's name (--vault-name). |
name | name(name: string): this | The secret's name (--name). |
version | version(version: string): this | A specific version; the latest when omitted (--version). |
id | id(identifier: string): this | The secret's full identifier, instead of vault and name (--id). |
type AzLogAnalyticsRow = Record<string, string> One row of a Log Analytics answer: TableName, and each column by name.
class AzLoginSettings extends AzSettings Settings for az login, for the non-interactive forms a build uses. The interactive browser and device-code forms are left to .command("login").
Exactly one credential is sent: a secret (password), a certificate or a federatedToken for a service principal, or identity for a managed identity. A service principal without one would make the CLI prompt for a password, so it is refused here.
az login reads the global .subscription(...) as the subscription to make the default once it has signed in. Its output lists the account's subscriptions — no credential — so it is not masked.
| Member | Signature | Doc |
|---|---|---|
servicePrincipal | servicePrincipal(): this | Log in as a service principal (--service-principal). |
username | username(clientId: string): this | The service principal's client id (--username). |
tenant | tenant(tenant: string): this | The Microsoft Entra tenant, required for a service principal (--tenant). |
password | password(secret: string): this | The service principal's client secret (--password), sent on standard input as --password=@- so it never enters the argv, and registered with the run's redactor. Prefer federatedToken (no long-lived secret) or certificate. |
federatedToken | federatedToken(token: string): this | A federated token (OIDC) to exchange for the service principal's access (--federated-token), sent on standard input as --federated-token=@- and registered with the run's redactor. |
certificate | certificate(path: string): this | A PEM file with the service principal's key and certificate (--certificate). |
useCertSnIssuer | useCertSnIssuer(): this | Authenticate with Subject Name + Issuer, for automatic certificate rolls (--use-cert-sn-issuer). |
identity | identity(): this | Log in with the managed identity of the machine the build runs on (--identity). |
clientId | clientId(id: string): this | A user-assigned managed identity, by client id (--client-id). |
objectId | objectId(id: string): this | A user-assigned managed identity, by object id (--object-id). |
resourceId | resourceId(id: string): this | A user-assigned managed identity, by resource id (--resource-id). |
allowNoSubscriptions | allowNoSubscriptions(): this | Succeed for a tenant with no subscriptions (--allow-no-subscriptions). |
class AzLogoutSettings extends AzSettings Settings for az logout.
| Member | Signature | Doc |
|---|---|---|
username | username(name: string): this | The account to log out; the active one when omitted (--username). |
class AzMonitorActivityLogListSettings extends AzSettings Settings for az monitor activity-log list: the control-plane events of a subscription, resource group or resource. The CLI returns at most maxEvents — 50 unless told otherwise.
| Member | Signature | Doc |
|---|---|---|
startTime | startTime(time: AzTime): this | The start of the range (--start-time). |
endTime | endTime(time: AzTime): this | The end of the range (--end-time); now by default. |
offset | offset(duration: string | number): this | The length of the range when only one end is given (--offset); six hours by default. |
resourceGroup | resourceGroup(name: string): this | Only events in this resource group (--resource-group). |
resourceId | resourceId(id: string): this | Only events on this resource (--resource-id). |
namespace | namespace(namespace: string): this | Only events from this resource provider (--namespace). |
caller | caller(caller: string): this | Only events by this caller (--caller). |
status | status(status: string): this | Only events with this status, e.g. "Failed" (--status). |
correlationId | correlationId(id: string): this | Only the events of this operation (--correlation-id). |
maxEvents | maxEvents(count: number): this | The most events to return (--max-events); 50 by default. |
select | select(...properties: string[]): this | Only these properties of each event (--select); repeatable. |
type AzMonitorAggregate = latest | sum | average | maximum | minimum How AzMonitorMetricValueSettings turns the datapoints into one number: the newest, or the sum, average, maximum or minimum of all of them.
type AzMonitorAggregation = Average | Count | Maximum | Minimum | Total The aggregations Azure Monitor computes per interval (--aggregation).
interface AzMonitorAnalysis A health check run against a canary, in the shape @zuke/canary's c.analysis(...) accepts: throw to fail it, which rolls the rollout back.
| Member | Signature | Doc |
|---|---|---|
validate | validate(context: AzMonitorAnalysisContext): Promise<void> | Read the metric and throw when a datapoint is out of bounds. |
name | name: string | "azureMonitor", for diagnostics. |
interface AzMonitorAnalysisContext The part of the canary engine's context the analysis uses: the run's redactor, applied to every failure message. The engine hands a richer context; this is the narrow view.
| Member | Signature | Doc |
|---|---|---|
redact | redact(text: string): string | Mask every resolved secret parameter in text. |
class AzMonitorAnalysisSettings Settings for azureMonitor: the metric or query, the window and the bounds.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | What to call the metric when it is out of bounds. |
resource | resource(id: string): this | The resource whose metric is read, by full resource id (--resource). |
metric | metric(name: string): this | The metric to judge, by name (--metrics). |
namespace | namespace(namespace: string): this | The metric's namespace, when the resource has several (--namespace). |
aggregation | aggregation(aggregation: AzMonitorAggregation): this | The aggregation judged per interval (--aggregation), e.g. "Total". |
interval | interval(interval: AzMonitorInterval): this | What each datapoint covers (--interval; default PT1M). Every datapoint is judged, so .max(5) on a per-minute Total means "no minute with more than five". |
dimension | dimension(name: string, value: string): this | Only the series where dimension name is value; repeatable. |
kql | kql(workspace: string, query: string): this | Judge a Log Analytics query instead of a metric: query must return one row with one numeric column (... | summarize count()), run over the window against the workspace workspace. Needs the CLI's log-analytics extension installed. |
window | window(duration: string | number): this | How far back to read ("10m", or ms; default 5 minutes). For a metric the window ends at the last interval boundary, so the interval still being written is not judged. Azure Monitor publishes a datapoint a little after its interval ends, so the newest one in the window may still be short of data — harmless for a max, but a min on a Total or Count can fail on the lag rather than on the candidate. |
min | min(value: number): this | Fail when any datapoint is below value, a finite number. |
max | max(value: number): this | Fail when any datapoint is above value, a finite number. |
top | top(count: number): this | The most series to read (--top; the CLI's default is ten). Azure Monitor applies it to a query narrowed by dimension, and the analysis fails rather than judge an answer that reached it — raise it when a dimension value matches more series than that. |
missingDataAs | missingDataAs(value: number): this | Judge value when the window has no data, instead of failing. Azure Monitor reports nothing for an interval with no events, so for a count of errors no data means 0; for a latency it usually means the resource, metric or dimensions are wrong, which is why that is a failure by default. |
az | az(configure: Configure<AzSettings>): this | Global options for the command — (a) => a.subscription("prod"), a .toolPath(...), or a .runner(...), the seam a test answers through. --output and --query are the analysis's own and are set after it. |
now | now(clock: unknown): this | The clock the window is read against — the seam a test pins it with. |
name_? | name_?: string | What the metric is called in a failure (set by name). |
resource_? | resource_?: string | The resource whose metric is read (set by resource). |
metric_? | metric_?: string | The metric's name (set by metric). |
namespace_? | namespace_?: string | The metric's namespace (set by namespace). |
aggregation_? | aggregation_?: AzMonitorAggregation | The aggregation judged (set by aggregation). |
interval_ | interval_: AzMonitorInterval | What each datapoint covers (set by interval). |
dimensions_ | dimensions_: Array<unknown> | The dimension values the series is narrowed to (set by dimension). |
kql_? | kql_?: unknown | The workspace and query of the KQL mode (set by kql). |
top_? | top_?: number | The most series to read (set by top). |
window_ | window_: number | How far back to read, in ms (set by window). |
min_? | min_?: number | The lowest acceptable value (set by min). |
max_? | max_?: number | The highest acceptable value (set by max). |
missingData_? | missingData_?: number | The value to judge when there is no data (set by missingDataAs). |
az_ | az_: Configure<AzSettings> | Global options for the command (set by az). |
now_ | now_: unknown | The clock the window is read against (set by now). |
type AzMonitorInterval = PT1M | PT5M | PT15M | PT30M | PT1H | PT6H | PT12H | PT24H The time grains metrics list --interval takes, in ISO 8601 — the form the CLI passes through unchanged. (Its ##h##m shorthand writes a mixed duration such as 1h30m in the wrong order, so it is not offered.)
class AzMonitorLogAnalyticsQuerySettings extends AzSettings Settings for az monitor log-analytics query.
| Member | Signature | Doc |
|---|---|---|
workspace | workspace(id: string): this | The workspace's id — its customer id, a GUID (--workspace). |
analyticsQuery | analyticsQuery(query: string): this | The KQL query (--analytics-query). |
timespan | timespan(range: string | number): this | The range to query (--timespan): a duration back from now, as "30m" or milliseconds (sent as ISO 8601), or an ISO 8601 interval string such as "2026-10-07T10:00:00Z/2026-10-07T11:00:00Z", sent as written. All the data by default. |
workspaces | workspaces(...ids: string[]): this | Further workspaces to union into the query (--workspaces); repeatable. |
class AzMonitorMetricsAlertListSettings extends AzSettings Settings for az monitor metrics alert list.
| Member | Signature | Doc |
|---|---|---|
resourceGroup | resourceGroup(name: string): this | Only the rules in this resource group (--resource-group). |
class AzMonitorMetricsAlertShowSettings extends AzResourceSettings Settings for az monitor metrics alert show: one metric alert rule. The rule's definition, not whether it is firing — that lives in Azure Monitor's alerts, not in the rule.
class AzMonitorMetricsListDefinitionsSettings extends AzSettings Settings for az monitor metrics list-definitions: the metrics a resource has.
| Member | Signature | Doc |
|---|---|---|
resource | resource(id: string): this | The resource, by full resource id (--resource). |
namespace | namespace(namespace: string): this | Only this metric namespace (--namespace). |
class AzMonitorMetricsListSettings extends AzSettings Settings for az monitor metrics list: a resource's metrics over a time range, one datapoint per interval.
The CLI returns at most top time series per metric — ten unless told otherwise — so a query that splits by a dimension can silently lose series; raise top to cover them.
| Member | Signature | Doc |
|---|---|---|
resource | resource(id: string): this | The resource, by full resource id (--resource). |
metrics | metrics(...names: string[]): this | The metrics to read, by name (--metrics); repeatable. |
aggregation | aggregation(...types: AzMonitorAggregation[]): this | The aggregations to compute per interval (--aggregation); repeatable. |
interval | interval(interval: AzMonitorInterval): this | The time grain of each datapoint (--interval); one minute by default. The range set by window is not aligned to it, so the newest datapoint may cover an interval that is still being written. |
startTime | startTime(time: AzTime): this | The start of the range (--start-time). |
endTime | endTime(time: AzTime): this | The end of the range (--end-time); now by default. |
window | window(duration: string | number, end?: Date): this | The duration ("15m", or milliseconds) up to end — now, unless given — as --start-time and --end-time. |
offset | offset(duration: string | number): this | The length of the range when only one end is given (--offset, as "30m" or milliseconds); an hour by default. |
filter | filter(expression: string): this | An OData filter on the dimensions (--filter), e.g. "ApiName eq 'GetBlob' and GeoType eq '*'". For plain equality, prefer dimension, which quotes the value. |
dimension | dimension(name: string, value: string): this | Only the series where the dimension name is value — rendered into --filter as name eq 'value', joined with and; repeatable. |
splitBy | splitBy(...dimensions: string[]): this | Split the series by these dimensions (--dimension); repeatable. |
namespace | namespace(namespace: string): this | The metric namespace (--namespace). |
top | top(count: number): this | The most time series to return per metric (--top); 10 by default. |
seriesLimit_ | seriesLimit_(): number | undefined | The most series the answer can hold, when the query can return several — top, or the CLI's default of ten — and undefined when it cannot. Azure Monitor applies --top only to a filtered or split query; without one there is a single series. A reader that totals the series reads this to tell a complete answer from one cut at the limit. |
orderby | orderby(order: string): this | The aggregation and direction to sort series by (--orderby), e.g. "sum desc". |
aggregations_ | aggregations_: AzMonitorAggregation[] | The aggregations to compute (set by aggregation). |
class AzMonitorMetricValueSettings extends AzMonitorMetricsListSettings Settings for AzTasks.metricValue: a metrics list request with exactly one AzMonitorMetricsListSettings.aggregation, and how to read it.
| Member | Signature | Doc |
|---|---|---|
metric | metric(name: string): this | The metric to read, by name. Needed only when the request names more than one with .metrics(...). |
aggregate | aggregate(how: AzMonitorAggregate): this | How to turn the datapoints into one number, across every series the answer holds. "latest" (the default) is the newest interval — the sum of the series' values at the newest timestamp any of them has, so a metric split by a dimension reads as its total. The others combine every datapoint in the range: a "sum" of per-minute Totals is the range's total. |
missingDataAs | missingDataAs(value: number): this | Return value when there are no datapoints, instead of failing. Azure Monitor reports an interval with no events without a value, so for a count of errors no data does mean 0; for a latency it usually means the query is looking in the wrong place. |
metric_? | metric_?: string | The metric to read (set by metric); the only one when unset. |
aggregate_ | aggregate_: AzMonitorAggregate | How to turn the datapoints into one number (set by aggregate). |
missingData_? | missingData_?: number | The value to return when there are no datapoints (set by missingDataAs). |
class AzOutputError extends Error The Azure CLI succeeded but printed something a reader cannot use: output that is not JSON, JSON of an unexpected shape, an empty or multi-line answer where one value was expected, no data where a number was expected, or a capture that was truncated.
The message never quotes the output itself. Several readers return access tokens and secret values, and an error that echoed what the CLI printed would put the secret in the build log it was read to stay out of.
| Member | Signature | Doc |
|---|---|---|
name | name: string | The error name. |
type AzOutputFormat = json | jsonc | yaml | yamlc | table | tsv | none The values the Azure CLI's --output option accepts.
class AzResourceSettings extends AzSettings Settings for a command on one named resource in a resource group.
| Member | Signature | Doc |
|---|---|---|
name | name(name: string): this | The resource's name (--name). |
resourceGroup | resourceGroup(name: string): this | The resource group the resource is in (--resource-group). |
class AzSettings extends SubcommandSettings Settings for an az invocation.
Every instance sets three of the CLI's configuration variables in the child's environment, so the CLI never waits on a keypress, installs code, or colours a build log:
- AZURE_EXTENSION_USE_DYNAMIC_INSTALL=no — a command from an extension that is not installed fails, instead of prompting (on a terminal) or silently downloading and installing the extension (without one). The CLI's message does not name the extension — it says the command is misspelled or not recognized by the system and exits 2 — so install what a build needs up front with az extension add --name <name>. - AZURE_CORE_LOGIN_EXPERIENCE_V2=off — an interactive az login does not open its subscription selector. - AZURE_CORE_NO_COLOR=true — no ANSI colour codes in captured output.
Setting them there keeps the argv exactly what the settings say; override any of them with .env({...}). A confirmation prompt (group delete without --yes) is not switched off: on a terminal it asks, without one the CLI fails — call the command's .yes() to confirm in the build.
| Member | Signature | Doc |
|---|---|---|
subscription | subscription(nameOrId: string): this | The subscription to run against, by name or id (--subscription); the CLI's default subscription when omitted. Most commands take it; the account commands read it as the subscription they act on. |
output | output(format: AzOutputFormat): this | The output format (--output): json, jsonc, yaml, yamlc, table, tsv or none. |
query | query(expression: string): this | A JMESPath expression that filters the output (--query). |
onlyShowErrors | onlyShowErrors(): this | Print errors only, suppressing warnings (--only-show-errors). The CLI refuses it beside --debug or --verbose, and so do these settings. |
verbose | verbose(): this | More logging, on stderr (--verbose). |
env | env(record: Record<string, string>): this | Merge additional environment variables for the process. Under debug — set before or after — a credential variable set here is registered with the run's redactor, like one in the build's environment. |
debug | debug(): this | Turn on the CLI's debug logging (--debug), written to stderr. The debug log can carry credentials: request and response details, which for a Key Vault or storage command include what was read or sent. The credentials the CLI reads from the environment — AZURE_STORAGE_KEY, AZURE_STORAGE_CONNECTION_STRING, AZURE_STORAGE_SAS_TOKEN, AZURE_CLIENT_SECRET, AZURE_DEVOPS_EXT_PAT, and Terraform's ARM_CLIENT_SECRET beside them — are registered with the run's redactor, whether they are in the build's environment or set with env, but a token the CLI holds in its own cache (~/.azure) is not known here and is not masked. Keep it for a local investigation, never a shared CI log. |
flag | flag(name: string, value?: string | number): this | Add an arbitrary option: --name value, or the bare --name. Two hazards come with the escape hatch, which the typed setters guard and this does not: a value that starts with - is read by the CLI as the next option, and a value that starts with @ — or, in a key=value list element, a value after the = that does — is replaced by that file's contents (@- by standard input), which then leave the machine in the request. Never pass an untrusted value here, or through .args(...) or .command(...). |
runner | runner(run: AzSettingsRunner): this | Replace how this command is run. The default spawns the CLI; this is the seam a test answers commands through, and the way a build executes az through something else. The runner reads the argv from the settings it is handed and must not call their run() — that is the call it replaces. |
run | run(): Promise<CommandOutput> | Run the command — through the runner when one is set, otherwise by spawning the CLI. Either way the output is reported to the settings' output hook and a non-zero exit throws a CommandError unless .noThrow() was called. |
type AzSettingsRunner = unknown Runs one prepared az command and returns what the process produced. The default spawns the CLI; a test, or a build that executes the CLI some other way, injects its own with AzSettings.runner. The runner only produces the output: the exit code is judged afterwards exactly as for a spawned process, so a non-zero code still raises a CommandError unless the settings say .noThrow().
type AzSlotSwapAction = swap | preview | reset The kinds of swap webapp deployment slot swap --action performs.
type AzStorageAuthMode = login | key How a storage command authenticates (--auth-mode).
class AzStorageBlobDownloadSettings extends AzStorageBlobSettings Settings for az storage blob download.
| Member | Signature | Doc |
|---|---|---|
containerName | containerName(name: string): this | The container (--container-name). |
name | name(name: string): this | The blob's name (--name). |
file | file(path: string): this | The local file to write (--file). |
overwrite | overwrite(value: boolean): this | Replace an existing local file (--overwrite). |
class AzStorageBlobSettings extends AzSettings The account and credential options every storage blob command takes. One credential at most: the CLI reads it from standard input.
| Member | Signature | Doc |
|---|---|---|
accountName | accountName(name: string): this | The storage account (--account-name). |
authMode | authMode(mode: AzStorageAuthMode): this | login uses the signed-in identity; key an account key (--auth-mode). |
accountKey | accountKey(key: string): this | The account key (--account-key), sent on standard input. |
sasToken | sasToken(token: string): this | A SAS token (--sas-token), sent on standard input. Its signature is registered on its own as well — as written, decoded and URL-encoded — since the CLI's debug log prints the token URL-encoded inside a request URL, where the token as a whole never appears. |
connectionString | connectionString(connection: string): this | A connection string (--connection-string), sent on standard input. |
class AzStorageBlobUploadBatchSettings extends AzStorageBlobSettings Settings for az storage blob upload-batch: upload a directory.
| Member | Signature | Doc |
|---|---|---|
source | source(path: string): this | The local directory to upload (--source). |
destination | destination(container: string): this | The container, by name or URL (--destination). |
pattern | pattern(glob: string): this | Upload only the files matching this glob (--pattern). |
destinationPath | destinationPath(path: string): this | A path inside the container to upload under (--destination-path). |
overwrite | overwrite(value: boolean): this | Replace existing blobs (--overwrite). |
dryrun | dryrun(): this | Show what would be uploaded without uploading (--dryrun). |
class AzStorageBlobUploadSettings extends AzStorageBlobSettings Settings for az storage blob upload.
| Member | Signature | Doc |
|---|---|---|
containerName | containerName(name: string): this | The container (--container-name). |
name | name(name: string): this | The blob's name (--name). |
file | file(path: string): this | The local file to upload (--file). |
overwrite | overwrite(value: boolean): this | Replace an existing blob (--overwrite). |
contentType | contentType(type: string): this | The blob's MIME type (--content-type). |
contentCacheControl | contentCacheControl(value: string): this | The blob's Cache-Control (--content-cache-control). |
tag | tag(key: string, value: string): this | A blob index tag (--tags key=value); repeatable. |
const AzTasks: AzTasksApi Typed task functions for the az CLI.
interface AzTasksApi The shape of AzTasks.
| Member | Signature | Doc |
|---|---|---|
run | run(configure?: Configure<AzSettings>): Promise<CommandOutput> | Run any az command, built with .command(group, …, verb). |
login | login(configure?: Configure<AzLoginSettings>): Promise<CommandOutput> | Sign the CLI in, non-interactively: az login. |
logout | logout(configure?: Configure<AzLogoutSettings>): Promise<CommandOutput> | Sign the CLI out: az logout. |
accountShow | accountShow(configure?: Configure<AzAccountShowSettings>): Promise<CommandOutput> | Describe the current subscription: az account show. |
accountSet | accountSet(configure?: Configure<AzAccountSetSettings>): Promise<CommandOutput> | Make a subscription the default: az account set. |
accountList | accountList(configure?: Configure<AzAccountListSettings>): Promise<CommandOutput> | List the subscriptions: az account list. |
accountGetAccessToken | accountGetAccessToken(configure?: Configure<AzAccountGetAccessTokenSettings>): Promise<CommandOutput> | Get an access token: az account get-access-token (captured, never streamed). |
accessToken | accessToken(configure?: Configure<AzAccountGetAccessTokenSettings>): Promise<string> | An access token, read back as a string and registered as a secret. Pins --query accessToken --output json. |
subscriptionId | subscriptionId(configure?: Configure<AzAccountShowSettings>): Promise<string> | The subscription id the CLI acts on. Pins --query id --output tsv. |
tenantId | tenantId(configure?: Configure<AzAccountShowSettings>): Promise<string> | The tenant id of the current subscription. Pins --query tenantId --output tsv. |
groupCreate | groupCreate(configure?: Configure<AzGroupCreateSettings>): Promise<CommandOutput> | Create a resource group: az group create. |
groupShow | groupShow(configure?: Configure<AzGroupShowSettings>): Promise<CommandOutput> | Describe a resource group: az group show. |
groupDelete | groupDelete(configure?: Configure<AzGroupDeleteSettings>): Promise<CommandOutput> | Delete a resource group: az group delete. |
groupExists | groupExists(configure?: Configure<AzGroupExistsSettings>): Promise<CommandOutput> | Print whether a resource group exists: az group exists. |
resourceGroupExists | resourceGroupExists(name: string, configure?: Configure<AzGroupExistsSettings>): Promise<boolean> | Whether resource group name exists. Pins --output json. |
acrLogin | acrLogin(configure?: Configure<AzAcrLoginSettings>): Promise<CommandOutput> | Log in to a registry: az acr login (captured, never streamed). |
acrToken | acrToken(configure?: Configure<AzAcrLoginSettings>): Promise<string> | A registry refresh token, for docker login as 00000000-0000-0000-0000-000000000000: az acr login --expose-token, read back and registered as a secret. Pins --query accessToken --output json. |
acrBuild | acrBuild(configure?: Configure<AzAcrBuildSettings>): Promise<CommandOutput> | Build and push an image in the registry: az acr build. |
acrRepositoryShowTags | acrRepositoryShowTags(configure?: Configure<AzAcrRepositoryShowTagsSettings>): Promise<CommandOutput> | List a repository's tags: az acr repository show-tags. |
acrRepositoryDelete | acrRepositoryDelete(configure?: Configure<AzAcrRepositoryDeleteSettings>): Promise<CommandOutput> | Delete an image or a repository: az acr repository delete. |
aksGetCredentials | aksGetCredentials(configure?: Configure<AzAksGetCredentialsSettings>): Promise<CommandOutput> | Write a cluster's credentials to a kubeconfig: az aks get-credentials. |
aksShow | aksShow(configure?: Configure<AzAksShowSettings>): Promise<CommandOutput> | Describe a cluster: az aks show. |
containerappUpdate | containerappUpdate(configure?: Configure<AzContainerappUpdateSettings>): Promise<CommandOutput> | Roll a container app onto a new revision: az containerapp update. |
containerappShow | containerappShow(configure?: Configure<AzContainerappShowSettings>): Promise<CommandOutput> | Describe a container app: az containerapp show. |
containerappFqdn | containerappFqdn(configure?: Configure<AzContainerappShowSettings>): Promise<string> | A container app's ingress FQDN. Pins --query properties.configuration.ingress.fqdn --output tsv; fails for an app without ingress. |
containerappRevisionList | containerappRevisionList(configure?: Configure<AzContainerappRevisionListSettings>): Promise<CommandOutput> | List a container app's revisions: az containerapp revision list. |
containerappRevisionActivate | containerappRevisionActivate(configure?: Configure<AzContainerappRevisionSettings>): Promise<CommandOutput> | Activate a revision: az containerapp revision activate. |
containerappRevisionDeactivate | containerappRevisionDeactivate(configure?: Configure<AzContainerappRevisionSettings>): Promise<CommandOutput> | Deactivate a revision: az containerapp revision deactivate. |
containerappIngressTrafficSet | containerappIngressTrafficSet(configure?: Configure<AzContainerappIngressTrafficSetSettings>): Promise<CommandOutput> | Split traffic between revisions or labels: az containerapp ingress traffic set. |
webappDeploy | webappDeploy(configure?: Configure<AzWebappDeploySettings>): Promise<CommandOutput> | Deploy an artifact to a web app: az webapp deploy. |
webappShow | webappShow(configure?: Configure<AzWebappShowSettings>): Promise<CommandOutput> | Describe a web app: az webapp show. |
webappHostName | webappHostName(configure?: Configure<AzWebappShowSettings>): Promise<string> | A web app's default host name. Pins --query defaultHostName --output tsv. |
webappConfigAppsettingsSet | webappConfigAppsettingsSet(configure?: Configure<AzWebappConfigAppsettingsSetSettings>): Promise<CommandOutput> | Set app settings: az webapp config appsettings set. |
webappDeploymentSlotSwap | webappDeploymentSlotSwap(configure?: Configure<AzWebappDeploymentSlotSwapSettings>): Promise<CommandOutput> | Swap a deployment slot: az webapp deployment slot swap. |
functionappDeploymentSourceConfigZip | functionappDeploymentSourceConfigZip(configure?: Configure<AzFunctionappDeploymentSourceConfigZipSettings>): Promise<CommandOutput> | Deploy a zip package to a function app: az functionapp deployment source config-zip. |
keyvaultSecretShow | keyvaultSecretShow(configure?: Configure<AzKeyvaultSecretShowSettings>): Promise<CommandOutput> | Read a secret: az keyvault secret show (captured, never streamed). |
secretValue | secretValue(configure?: Configure<AzKeyvaultSecretShowSettings>): Promise<string> | A Key Vault secret's value, read back exactly — multi-line values and surrounding whitespace included — and registered as a secret. Pins --query value --output json. |
keyvaultSecretSet | keyvaultSecretSet(configure?: Configure<AzKeyvaultSecretSetSettings>): Promise<CommandOutput> | Write a secret: az keyvault secret set (captured, never streamed). |
deploymentGroupCreate | deploymentGroupCreate(configure?: Configure<AzDeploymentGroupCreateSettings>): Promise<CommandOutput> | Deploy a template to a resource group: az deployment group create. |
deploymentGroupShow | deploymentGroupShow(configure?: Configure<AzDeploymentGroupShowSettings>): Promise<CommandOutput> | Describe a deployment: az deployment group show. |
deploymentGroupWhatIf | deploymentGroupWhatIf(configure?: Configure<AzDeploymentGroupWhatIfSettings>): Promise<CommandOutput> | Preview what a deployment would change: az deployment group what-if. |
deploymentOutput | deploymentOutput(group: string, name: string, key: string, configure?: Configure<AzDeploymentGroupShowSettings>): Promise<string> | One output of deployment name in resource group group, read back as a string — a non-string output as its JSON text. Pins --query properties.outputs --output json; fails when there is no such output. |
storageBlobUpload | storageBlobUpload(configure?: Configure<AzStorageBlobUploadSettings>): Promise<CommandOutput> | Upload a file to a blob: az storage blob upload. |
storageBlobDownload | storageBlobDownload(configure?: Configure<AzStorageBlobDownloadSettings>): Promise<CommandOutput> | Download a blob to a file: az storage blob download. |
storageBlobUploadBatch | storageBlobUploadBatch(configure?: Configure<AzStorageBlobUploadBatchSettings>): Promise<CommandOutput> | Upload a directory: az storage blob upload-batch. |
monitorMetricsList | monitorMetricsList(configure?: Configure<AzMonitorMetricsListSettings>): Promise<CommandOutput> | Read a resource's metrics: az monitor metrics list. |
metricValue | metricValue(configure: Configure<AzMonitorMetricValueSettings>): Promise<number> | One number from Azure Monitor: the latest datapoint of a metric, or an aggregate over the range. Pins --query value --output json; fails on no data unless .missingDataAs(value) says what it means. |
monitorMetricsListDefinitions | monitorMetricsListDefinitions(configure?: Configure<AzMonitorMetricsListDefinitionsSettings>): Promise<CommandOutput> | List a resource's metric definitions: az monitor metrics list-definitions. |
monitorMetricsAlertList | monitorMetricsAlertList(configure?: Configure<AzMonitorMetricsAlertListSettings>): Promise<CommandOutput> | List metric alert rules: az monitor metrics alert list. |
monitorMetricsAlertShow | monitorMetricsAlertShow(configure?: Configure<AzMonitorMetricsAlertShowSettings>): Promise<CommandOutput> | Describe a metric alert rule: az monitor metrics alert show. |
monitorActivityLogList | monitorActivityLogList(configure?: Configure<AzMonitorActivityLogListSettings>): Promise<CommandOutput> | List activity-log events: az monitor activity-log list. |
monitorLogAnalyticsQuery | monitorLogAnalyticsQuery(configure?: Configure<AzMonitorLogAnalyticsQuerySettings>): Promise<CommandOutput> | Run a KQL query: az monitor log-analytics query (the log-analytics extension). |
logAnalyticsQuery | logAnalyticsQuery(configure: Configure<AzMonitorLogAnalyticsQuerySettings>): Promise<AzLogAnalyticsRow[]> | The rows of a KQL query, every cell a string. Pins --output json and the whole answer as the query. |
type AzTime = Date | string A time given as a Date or as a string the CLI parses (ISO 8601).
function azureMonitor(configure: Configure<AzMonitorAnalysisSettings>): AzMonitorAnalysis An analysis that reads an Azure Monitor metric — or a KQL query — over a recent window and fails the canary when any datapoint is out of bounds, or when there is no data, unless AzMonitorAnalysisSettings.missingDataAs says what no data means.
The lambda runs on each check, so it may read resolved parameters, and every failure message — one from the lambda included — passes through the run's redactor.
type AzWebappArtifactType = war | jar | ear | lib | startup | static | zip The artifact types webapp deploy --type accepts.
class AzWebappConfigAppsettingsSetSettings extends AzResourceSettings Settings for az webapp config appsettings set.
Each setting's value is part of the argv, so it is visible in the process table and in the command line the build logs; a credential belongs in Key Vault, referenced with keyVaultReference. A value that starts with @ is otherwise refused, because the CLI would read it from a file. The CLI's answer lists every setting with its value redacted.
| Member | Signature | Doc |
|---|---|---|
setting | setting(name: string, value: string): this | An app setting (--settings name=value); repeatable. |
keyVaultReference | keyVaultReference(name: string, secretUri: string): this | An app setting whose value App Service reads from Key Vault; repeatable. Sent as the JSON object {"name":"@Microsoft.KeyVault(SecretUri=<uri>)"}, a form --settings accepts: written as name=@Microsoft… the CLI would first try to read a file of that name, and send its contents if one existed. |
slotSetting | slotSetting(name: string, value: string): this | A setting that stays with its slot through a swap (--slot-settings name=value); repeatable. |
slot | slot(name: string): this | A slot instead of production (--slot). |
class AzWebappDeploymentSlotSwapSettings extends AzResourceSettings Settings for az webapp deployment slot swap: swap a slot with production, or with targetSlot.
| Member | Signature | Doc |
|---|---|---|
slot | slot(name: string): this | The slot to swap from (--slot). |
targetSlot | targetSlot(name: string): this | The slot to swap with; production by default (--target-slot). |
action | action(action: AzSlotSwapAction): this | preview applies the target's settings to the source first, swap completes the swap, reset cancels a preview (--action). |
preserveVnet | preserveVnet(value: boolean): this | Keep the virtual network with the slot (--preserve-vnet). |
class AzWebappDeploySettings extends AzResourceSettings Settings for az webapp deploy, the current deploy command (the older webapp deployment source config-zip is deprecated in its favour).
| Member | Signature | Doc |
|---|---|---|
srcPath | srcPath(path: string): this | The artifact to deploy, a local path (--src-path). |
srcUrl | srcUrl(url: string): this | The artifact to deploy, a URL the app pulls it from (--src-url). |
type | type(type: AzWebappArtifactType): this | The artifact's type, when its extension does not say (--type). |
targetPath | targetPath(path: string): this | Where to deploy it, an absolute path on the app (--target-path). |
slot | slot(name: string): this | The slot to deploy to; production when omitted (--slot). |
async | async(value?: boolean): this | Return once the artifact is pushed, without waiting for it to deploy (--async). |
restart | restart(value: boolean): this | Restart the app after deploying (--restart); the CLI's default is to. |
clean | clean(value: boolean): this | Empty the target directory first (--clean). |
timeout | timeout(ms: number): this | How long to wait for the deployment, in milliseconds (--timeout). |
class AzWebappShowSettings extends AzResourceSettings Settings for az webapp show.
| Member | Signature | Doc |
|---|---|---|
slot | slot(name: string): this | A slot instead of production (--slot). |
type AzWhatIfChangeType = Create | Delete | Deploy | Ignore | Modify | NoChange | Unsupported The kinds of change what-if --exclude-change-types can leave out.
function containerAppCanary(configure: Configure<AzContainerAppCanarySettings>): AzContainerAppCanary An Azure container app as a canary platform, for @zuke/canary:
c.platform(containerAppCanary((a) =>
a.name("api").resourceGroup("rg-prod").image(this.image.value)
.az((z) => z.subscription("prod"))
))
The lambda runs on every call, so it may read resolved parameters. The app must be in multiple-revision mode, with ingress.
- stage — reads the app (containerapp show); pins all traffic to the serving revision by name (ingress traffic set --revision-weight <stable>=100); deploys the image (containerapp update), which makes the candidate revision; checks it is Provisioned; records the rollout. - expose — ingress traffic set --revision-weight <stable>=<100-n> <candidate>=<n>. - promote — checks the latest revision is still the candidate, then --revision-weight latest=100 when traffic followed the latest revision before (once the candidate is also the newest ready revision), or <candidate>=100 <stable>=0 otherwise. - abort — --revision-weight <stable>=100 <candidate>=0 mid-rollout; run by hand, <stable>=100 to the revision set with .stable(...). A rollback with nothing recorded runs nothing: nothing was staged.
Every call after stage that has its record — expose, promote, and abort mid-rollout — compares the configured app, resource group and az flags with the record, reads the app and checks its resource id (which names the subscription), and refuses on any difference before changing anything. Expose and promote also check that the traffic still goes only to the stable revision and the candidate, and that the candidate is the revision staged. Every command after the check carries --subscription with the subscription the checked id names, so a default subscription that changes in the meantime cannot redirect it. The CLI has no conditional update for ingress traffic, so a change landing between a read and the write that follows it is not caught.