Manage Azure cloud resources imperatively using TypeScript.
- Write automation scripts in TypeScript with the features the language offers.
- Leverage the Azure CLI with simple result serialization and easy argument passing via Execa.
- Use API based upsert and get helpers, or work directly against the Azure SDK.
- Run steps asynchronously for improved performance in more complex scripts using
asyncandPromisefeatures. - Handle complex scenarios using TypeScript language features for branching or iteration.
import type { SkuName, StorageAccount } from "@azure/arm-storage";
import az from "armpit";
const sku: SkuName = "Standard_LRS";
const name = "garbagefile";
await az.account.ensureActiveAccount();
const rg = await az.group("samples", "centralus");
const sa = await rg<StorageAccount>`storage account create -n ${name} --sku ${sku} --kind StorageV2`;
console.log(`Storage account ready: ${sa.name}`);For more samples, see the samples workspace.
- This project depends on the Azure CLI to function. While it does use the SDK for some features, the core functionality and authentication is handled via the
azcommand line tools.
- Start with a clean slate typescript module or use an existing typescript module. See the sample tsconfig.json and package.json for inspiration.
- Install the package to use the tools:
npm i armpit - Write your script.
- Run your script. I like tsx but it's your script, so do what works for you. Example:
npx tsx doTheThings.ts