Skip to content

lstk az Azure CLI proxy#251

Open
carole-lavillonniere wants to merge 4 commits into
mainfrom
flc-656-register-azure-custom-cloud-in-lstk
Open

lstk az Azure CLI proxy#251
carole-lavillonniere wants to merge 4 commits into
mainfrom
flc-656-register-azure-custom-cloud-in-lstk

Conversation

@carole-lavillonniere
Copy link
Copy Markdown
Collaborator

@carole-lavillonniere carole-lavillonniere commented May 19, 2026

Motivation

Bring Azure CLI integration into lstk so users can run az commands against the LocalStack Azure emulator. Uses the wrap model (isolated AZURE_CONFIG_DIR), not start-interception global mutation — it mirrors lstk aws and leaves the user's global ~/.azure untouched.

Depends on #262 (Support starting the Azure emulator) to actually launch the emulator via lstk start.

Approach

The Azure CLI has no --endpoint-url/--profile; the only isolation knob is AZURE_CONFIG_DIR. Inside that isolated dir we register a custom Azure cloud (LocalStack) whose endpoints point at the LocalStack Azure emulator, activate it, disable instance discovery, and perform a one-time dummy service-principal login:

  • lstk setup azure runs (against the isolated AZURE_CONFIG_DIR):
    • az cloud register|update --name LocalStack --cloud-config '{…}'
    • az cloud set --name LocalStack
    • az config set core.instance_discovery=false
    • az login --service-principal -u any-app -p any-pass --tenant anytenant
  • lstk az <args> runs az <args> with just AZURE_CONFIG_DIR set — no HTTP(S) forward proxy. az talks directly to LocalStack for Azure service URLs and to the real internet for everything else (extension downloads, AAD static content, etc.).

Closes FLC-656

Error when not setup first

az-setup-first

Setup

az-setup

Proxy

az-proxy

Not affecting global az config

az-not-global az-real

Trace

image

@carole-lavillonniere carole-lavillonniere changed the title Add lstk setup azure for registering LocalStack custom cloud Add lstk setup azure for registering custom cloud May 19, 2026
@carole-lavillonniere carole-lavillonniere changed the title Add lstk setup azure for registering custom cloud Add lstk az Azure CLI integration via LocalStack proxy May 27, 2026
@carole-lavillonniere carole-lavillonniere changed the base branch from main to az-support May 27, 2026 12:40
@carole-lavillonniere carole-lavillonniere force-pushed the flc-656-register-azure-custom-cloud-in-lstk branch 2 times, most recently from 62261ac to c6c0934 Compare May 28, 2026 12:46
@carole-lavillonniere carole-lavillonniere changed the title Add lstk az Azure CLI integration via LocalStack proxy lstk az Azure CLI proxy May 28, 2026
@carole-lavillonniere carole-lavillonniere force-pushed the flc-656-register-azure-custom-cloud-in-lstk branch 3 times, most recently from 9c33edc to f32fd1c Compare June 1, 2026 13:37
@carole-lavillonniere carole-lavillonniere force-pushed the flc-656-register-azure-custom-cloud-in-lstk branch 2 times, most recently from 8209390 to 273d465 Compare June 1, 2026 14:23
@carole-lavillonniere carole-lavillonniere force-pushed the flc-656-register-azure-custom-cloud-in-lstk branch from 273d465 to d988329 Compare June 1, 2026 14:30
@carole-lavillonniere carole-lavillonniere marked this pull request as ready for review June 1, 2026 14:35
@carole-lavillonniere carole-lavillonniere force-pushed the flc-656-register-azure-custom-cloud-in-lstk branch from d988329 to 00775ab Compare June 1, 2026 14:37
Base automatically changed from az-support to main June 1, 2026 14:55
@carole-lavillonniere carole-lavillonniere force-pushed the flc-656-register-azure-custom-cloud-in-lstk branch from 00775ab to ad41209 Compare June 1, 2026 14:56
Copy link
Copy Markdown

@bblommers bblommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome - thanks @carole-lavillonniere!

Note that I have not actually tested this out, but the Azure-specific parts LGTM 🙏

Comment thread cmd/az.go Outdated
Comment thread cmd/setup.go Outdated
Copy link
Copy Markdown
Collaborator

@anisaoshafi anisaoshafi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread internal/azurecli/exec.go
@anisaoshafi
Copy link
Copy Markdown
Collaborator

anisaoshafi commented Jun 2, 2026

@bblommers Not sure if it's a known issue, but when trying az login, I get this error which believe it's on the emulator or az cli config:

lstk:
image
emulator logs:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants