Skip to content
Get Started for Free

lstk Cloud & IaC Commands

lstk proxies developer tools so they run directly against LocalStack.

Run Azure CLI commands against the running LocalStack Azure emulator. lstk az runs az with an isolated AZURE_CONFIG_DIR in which a custom Azure cloud is registered against LocalStack’s endpoints, so your global ~/.azure configuration is left untouched and plain az keeps talking to real Azure.

Run lstk setup azure once before using this mode. Until you do, lstk az stops with Azure CLI integration is not set up and points you to lstk setup azure. Arguments are forwarded to the host az binary, and its exit code and output are passed through unchanged. lstk’s own flags (--non-interactive, --config) are consumed by lstk rather than forwarded, for example lstk az --non-interactive … suppresses the loading spinner instead of passing the flag to az. --endpoint-url is different: it must come before az. lstk --endpoint-url <url> az group list works, while lstk az --endpoint-url <url> group list and lstk az group list --endpoint-url <url> hand the flag to az, which rejects it.

Terminal window
lstk az group list
lstk az storage account list

The Azure CLI has no --endpoint-url/--profile equivalent, so the isolation relies entirely on the dedicated config directory prepared by setup azure.

The Azure emulator serves its endpoints under *.localhost.localstack.cloud, so lstk az needs those names to resolve to 127.0.0.1. If they don’t, for example because a DNS rebinding protection blocks them, lstk az stops with DNS resolution required for 'lstk az'. See lstk az fails with a DNS error for the fix, and run lstk doctor to check whether localhost.localstack.cloud resolves.

If a script must invoke plain az (not lstk az), you can redirect your global ~/.azure to LocalStack instead:

Terminal window
# Point global 'az' at the LocalStack Azure emulator
lstk az start-interception
# Switch back to real Azure
lstk az stop-interception

start-interception registers and activates the LocalStack cloud in your global Azure configuration so every az invocation targets LocalStack until you stop it. stop-interception switches the active cloud back to AzureCloud (override with --cloud <name>) and re-enables instance discovery, but only when LocalStack is still the active cloud, to avoid clobbering an unrelated selection.

Was this page helpful?