diff --git a/.github/workflows/run-samples.yml b/.github/workflows/run-samples.yml index 45f237e..659eb24 100644 --- a/.github/workflows/run-samples.yml +++ b/.github/workflows/run-samples.yml @@ -175,14 +175,16 @@ jobs: ACTIVATE_PRO: "1" DNS_ADDRESS: "0" - - name: Install Azure Functions Core Tools - # Required for publishing function app samples to the emulator. + - name: Install lstk CLI + # Required by run-samples.sh to proxy Azure CLI calls to the emulator + # via `lstk az` (replaces the deprecated azlocal wrapper). + # https://github.com/localstack/lstk run: | MAX_RETRIES=3 DELAY=15 for i in $(seq 1 $MAX_RETRIES); do echo "Attempt $i/$MAX_RETRIES..." - npm install -g azure-functions-core-tools@4 --unsafe-perm true && break + npm install -g @localstack/lstk && break if [ "$i" -eq "$MAX_RETRIES" ]; then echo "All $MAX_RETRIES attempts failed" exit 1 @@ -191,6 +193,7 @@ jobs: sleep $DELAY DELAY=$((DELAY * 2)) done + command -v lstk - name: Install MSSQL ODBC and Tools # Required for the 'web-app-sql-database' sample which uses 'sqlcmd' to diff --git a/README.md b/README.md index d3962e1..4561ed7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This repository contains comprehensive sample projects demonstrating how to deve ### Required Tools - [Docker](https://docs.docker.com/get-docker/): Container runtime for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting ### Infrastructure as Code @@ -79,12 +79,13 @@ Follow the comprehensive setup guide in [LocalStack for Azure Quick Start](./doc ## Documentation - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) -- [Azure CLI with LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) - [Supported Azure Services](https://azure.localstack.cloud/references/coverage/) ## Contributing -Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) before submitting pull requests. +Contributions are welcome! 1. Fork the repository 2. Create a feature branch diff --git a/docs/LOCALSTACK.md b/docs/LOCALSTACK.md index d83f285..23493e0 100644 --- a/docs/LOCALSTACK.md +++ b/docs/LOCALSTACK.md @@ -2,7 +2,7 @@ ## Overview You can emulate selected Azure services locally using the LocalStack Azure Docker image. Before you begin, you must export a valid `LOCALSTACK_AUTH_TOKEN`, which unlocks Azure emulation features. -Refer to the LocalStack Auth Token documentation (e.g. the [Auth Token guide](https://docs.localstack.cloud/references/auth-token/)) to obtain your token and set it as an environment variable. +Refer to the LocalStack Auth Token documentation (e.g. the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/)) to obtain your token and set it as an environment variable. ## Prerequisites - Docker installed and running @@ -36,7 +36,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` This: @@ -164,7 +164,4 @@ $Env:LOCALSTACK_AUTH_TOKEN = "" - Explore available Azure service endpoints through the LocalStack documentation - Script integration tests against `http://localhost:4566` - Combine with Terraform / SDK clients pointing to the LocalStack endpoint - ---- - -Let me know if you’d like an expanded example (e.g. adding a specific Azure service workflow or integrating with a dev container). \ No newline at end of file +- Proxy the Azure CLI to the emulator with [`lstk az`](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/), or run `lstk az start-interception` to intercept all `az` calls (see the [lstk GitHub repository](https://github.com/localstack/lstk)) diff --git a/pyproject.toml b/pyproject.toml index 2e37f44..a3fc6b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,8 +18,6 @@ dependencies = [ "azure-core", "python-dotenv", "localstack", - "azlocal", - "terraform-local", ] [project.optional-dependencies] diff --git a/requirements-runtime.txt b/requirements-runtime.txt index 6ede92c..18fdb02 100644 --- a/requirements-runtime.txt +++ b/requirements-runtime.txt @@ -8,4 +8,3 @@ azure-mgmt-cosmosdb azure-core python-dotenv localstack -azlocal diff --git a/run-samples.sh b/run-samples.sh index 7e3a5d7..f165987 100755 --- a/run-samples.sh +++ b/run-samples.sh @@ -5,14 +5,12 @@ set -euo pipefail # Requirements: # - Docker # - Python 3.12+ -# - .NET 9.0+ +# - .NET 10.0+ # - Node.js & npm # - Azure CLI (az) # - LocalStack CLI # - Terraform CLI -# - azlocal & terraform-local (pip install azlocal terraform-local) -# - Azure Functions Core Tools (func) -# - Azure Functions Core Tools (func) +# - lstk CLI (https://github.com/localstack/lstk) # - jq & zip (sudo apt-get install jq zip) # - MSSQL Tools (sqlcmd) # - LOCALSTACK_AUTH_TOKEN environment variable @@ -104,10 +102,8 @@ fi # 3. Check for required tools command -v localstack >/dev/null 2>&1 || { echo >&2 "localstack CLI is required but not installed. Aborting."; exit 1; } command -v az >/dev/null 2>&1 || { echo >&2 "az CLI is required but not installed. Aborting."; exit 1; } -command -v azlocal >/dev/null 2>&1 || { echo >&2 "azlocal is required but not installed. Run 'pip install azlocal'. Aborting."; exit 1; } -#command -v tflocal >/dev/null 2>&1 || { echo >&2 "tflocal is required but not installed. Run 'pip install terraform-local'. Aborting."; exit 1; } +command -v lstk >/dev/null 2>&1 || { echo >&2 "lstk is required but not installed. See https://github.com/localstack/lstk#installation. Aborting."; exit 1; } command -v terraform >/dev/null 2>&1 || { echo >&2 "terraform CLI is required but not installed. Aborting."; exit 1; } -command -v func >/dev/null 2>&1 || { echo >&2 "Azure Functions Core Tools (func) is required but not installed. Aborting."; exit 1; } if [ -z "${LOCALSTACK_AUTH_TOKEN:-}" ]; then echo "Error: LOCALSTACK_AUTH_TOKEN is not set. It is required for the Azure emulator." @@ -129,17 +125,20 @@ if [ -n "${AZURE_CONFIG_DIR:-}" ]; then mkdir -p "$AZURE_CONFIG_DIR" fi -if command -v azlocal >/dev/null 2>&1; then - echo "[DEBUG] azlocal command found, attempting login..." - azlocal login || true - echo "[DEBUG] Starting azlocal interception..." - azlocal start-interception +if command -v lstk >/dev/null 2>&1; then + echo "[DEBUG] Starting lstk az interception..." + lstk az start-interception + # With interception active, the standard az CLI targets the emulator directly. + # The `lstk az` proxy is intentionally not used below: it requires a one-time + # Azure CLI integration setup that is not available on headless CI runners. + echo "[DEBUG] Logging in..." + az login --service-principal -u any-app -p any-pass --tenant any-tenant || true echo "[DEBUG] Setting default subscription..." - azlocal account set --subscription "00000000-0000-0000-0000-000000000000" || true - echo "[DEBUG] Checking azlocal account status..." - azlocal account show --query "{Environment:environmentName, Subscription:id}" --output json 2>&1 || echo "[DEBUG] azlocal account show failed" + az account set --subscription "00000000-0000-0000-0000-000000000000" || true + echo "[DEBUG] Checking az account status..." + az account show --query "{Environment:environmentName, Subscription:id}" --output json 2>&1 || echo "[DEBUG] az account show failed" else - echo "[DEBUG] azlocal not found, using standard az login with service principal..." + echo "[DEBUG] lstk not found, using standard az login with service principal..." az login --service-principal -u any-app -p any-pass --tenant any-tenant || true echo "[DEBUG] Checking az account status..." az account show --query "{Environment:environmentName, Subscription:id}" --output json 2>&1 || echo "[DEBUG] az account show failed" @@ -196,13 +195,14 @@ for (( i=START; i/dev/null 2>&1; then - RG_LIST=$(azlocal group list --query "[].name" -o tsv 2>/dev/null || echo "") + if command -v lstk >/dev/null 2>&1; then + # Interception is active (started above), so plain az targets the emulator. + RG_LIST=$(az group list --query "[].name" -o tsv 2>/dev/null || echo "") if [[ -n "$RG_LIST" ]]; then echo "$RG_LIST" | while read -r rg; do if [[ -n "$rg" ]]; then echo " - Deleting resource group: $rg" - azlocal group delete --name "$rg" --yes --no-wait 2>/dev/null || true + az group delete --name "$rg" --yes --no-wait 2>/dev/null || true fi done sleep 2 diff --git a/samples/aci-blob-storage/python/README.md b/samples/aci-blob-storage/python/README.md index e3a9fd2..26c8eed 100644 --- a/samples/aci-blob-storage/python/README.md +++ b/samples/aci-blob-storage/python/README.md @@ -21,7 +21,7 @@ The following diagram illustrates the architecture of the solution: - [LocalStack](https://docs.localstack.cloud/getting-started/installation/) - [Docker](https://docs.docker.com/get-docker/) - [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) -- [azlocal](https://pypi.org/project/azlocal/) (`pip install azlocal`) +- [lstk](https://github.com/localstack/lstk) (`brew install localstack/tap/lstk` or `npm install -g @localstack/lstk`) - [Terraform](https://developer.hashicorp.com/terraform/downloads) (optional, for Terraform deployment) ## Quick Start @@ -32,10 +32,10 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception # Deploy all services -cd python +cd samples/aci-blob-storage/python bash scripts/deploy.sh # Validate the deployment (includes stop/start/restart lifecycle tests) @@ -47,14 +47,14 @@ bash scripts/validate.sh ### Bicep ```bash -cd python +cd samples/aci-blob-storage/python bash bicep/deploy.sh ``` ### Terraform ```bash -cd python +cd samples/aci-blob-storage/python bash terraform/deploy.sh ``` @@ -111,3 +111,9 @@ The Vacation Planner is a Flask web application with a Bootstrap UI that lets us | Container logs | validate.sh | | Container exec | validate.sh | | Stop / Start / Restart | validate.sh | + +## References + +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/aci-blob-storage/python/bicep/README.md b/samples/aci-blob-storage/python/bicep/README.md index 7b8b9e8..8dbea57 100644 --- a/samples/aci-blob-storage/python/bicep/README.md +++ b/samples/aci-blob-storage/python/bicep/README.md @@ -8,13 +8,13 @@ This directory contains the Bicep template and a deployment script for provision - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface - [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep): VS Code extension for Bicep language support -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting -### Installing azlocal CLI +### Installing lstk CLI ```bash -pip install azlocal +brew install localstack/tap/lstk # or: npm install -g @localstack/lstk ``` ## Architecture Overview @@ -60,3 +60,5 @@ bash scripts/cleanup.sh - [Azure Bicep Documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/) - [Bicep Language Reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/aci-blob-storage/python/scripts/README.md b/samples/aci-blob-storage/python/scripts/README.md index 1cfdbd7..1d05cfe 100644 --- a/samples/aci-blob-storage/python/scripts/README.md +++ b/samples/aci-blob-storage/python/scripts/README.md @@ -1,18 +1,18 @@ # Azure CLI Deployment -This directory includes Bash scripts for deploying and testing the ACI Vacation Planner sample using the `azlocal` CLI. Refer to the [ACI Blob Storage](../README.md) guide for details about the sample application. +This directory includes Bash scripts for deploying and testing the ACI Vacation Planner sample using the `lstk` CLI. Refer to the [ACI Blob Storage](../README.md) guide for details about the sample application. ## Prerequisites - [LocalStack for Azure](https://docs.localstack.cloud/azure/): Local Azure cloud emulator for development and testing - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) -### Installing azlocal CLI +### Installing lstk CLI ```bash -pip install azlocal +brew install localstack/tap/lstk # or: npm install -g @localstack/lstk ``` ## Architecture Overview @@ -49,3 +49,5 @@ bash scripts/cleanup.sh - [Azure CLI Documentation](https://docs.microsoft.com/en-us/cli/azure/) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/aci-blob-storage/python/terraform/README.md b/samples/aci-blob-storage/python/terraform/README.md index b487e9d..1c3dedf 100644 --- a/samples/aci-blob-storage/python/terraform/README.md +++ b/samples/aci-blob-storage/python/terraform/README.md @@ -8,12 +8,12 @@ This directory contains Terraform modules and a deployment script for provisioni - [Terraform](https://developer.hashicorp.com/terraform/downloads): Infrastructure as Code tool - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) -### Installing azlocal CLI +### Installing lstk CLI ```bash -pip install azlocal +brew install localstack/tap/lstk # or: npm install -g @localstack/lstk ``` ## Architecture Overview @@ -67,3 +67,5 @@ rm -rf .terraform terraform.tfstate terraform.tfstate.backup .terraform.lock.hcl - [Terraform Azure Provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/aci-blob-storage/python/terraform/main.tf b/samples/aci-blob-storage/python/terraform/main.tf index 71088b2..07cc592 100644 --- a/samples/aci-blob-storage/python/terraform/main.tf +++ b/samples/aci-blob-storage/python/terraform/main.tf @@ -15,6 +15,14 @@ resource "azurerm_resource_group" "example" { name = local.resource_group_name location = var.location tags = var.tags + + lifecycle { + # deploy.sh pre-creates this resource group with `az group create` (untagged) and + # imports it into the Terraform state. Ignoring tag drift avoids an in-place + # resource-group update on the next apply, which azurerm >= 4.x issues as a PATCH + # request that the LocalStack Azure emulator does not implement yet. + ignore_changes = [tags] + } } # Create a storage account @@ -48,7 +56,7 @@ resource "azurerm_key_vault" "example" { location = azurerm_resource_group.example.location tenant_id = data.azurerm_client_config.current.tenant_id sku_name = "standard" - enable_rbac_authorization = true + rbac_authorization_enabled = true tags = var.tags lifecycle { diff --git a/samples/aci-blob-storage/python/terraform/providers.tf b/samples/aci-blob-storage/python/terraform/providers.tf index 0e83617..d01802f 100644 --- a/samples/aci-blob-storage/python/terraform/providers.tf +++ b/samples/aci-blob-storage/python/terraform/providers.tf @@ -4,7 +4,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.14.0" + version = "=4.81.0" } } } diff --git a/samples/function-app-front-door/python/README.md b/samples/function-app-front-door/python/README.md index dd82454..982dfaf 100644 --- a/samples/function-app-front-door/python/README.md +++ b/samples/function-app-front-door/python/README.md @@ -1,6 +1,6 @@ # Azure Function App and Azure Front Door (Azure CLI) -This sample creates a minimal Python Azure Function App that responds to `/{name}` and configures Azure Front Door (Standard SKU) to route traffic to it. It can target real Azure or LocalStack's Azure emulation via `azlocal` interception. +This sample creates a minimal Python Azure Function App that responds to `/{name}` and configures Azure Front Door (Standard SKU) to route traffic to it. It can target real Azure or LocalStack's Azure emulation via `lstk az` interception. ## Overview @@ -23,7 +23,7 @@ The following diagrams visualize each scenario provisioned by `deploy_all.sh`. T ### Multi-Origin (Priority/Weight) -![Multi-origin (priority/weight)](./images/nulti.png) +![Multi-origin (priority/weight)](./images/multi.png) **What to notice:** Two Origins in a single Origin Group with explicit `priority` and `weight`. A group-level health probe (HEAD `/`, 120s) gates origin eligibility; selection prefers the lowest priority and distributes by weight among equally prioritized healthy origins. @@ -56,13 +56,8 @@ The following diagrams visualize each scenario provisioned by `deploy_all.sh`. T - Bash (e.g., Git Bash, WSL, or Linux/macOS shell) - Azure CLI installed and logged in (`az login`) for real Azure -- **Optional**: `azlocal` (LocalStack's Azure interception helper) in PATH to target the emulator +- **Optional**: `lstk` (LocalStack CLI) in PATH to target the emulator via `lstk az` interception - `zip` utility in PATH (used for zip deploy to Azure) -- **For LocalStack**: `funclocal` and Azure Functions Core Tools (`func`) for publishing - -## Quick Start - -1. ## Quick Start @@ -73,7 +68,7 @@ The following diagrams visualize each scenario provisioned by `deploy_all.sh`. T localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator - azlocal start-interception + lstk az start-interception ``` 2. **Deploy against real Azure** (eastus by default): @@ -90,20 +85,6 @@ The script prints: - Resource group name - AFD endpoint hostnames for each scenario and sample URLs (e.g., `https://.z01.azurefd.net/john`) -## Cleanup - -Delete the resource group created by the deploy script: - -```bash -bash ./scripts/cleanup_all.sh --env-file ./scripts/.last_deploy_all.env -``` - -or - -```bash -bash ./scripts/cleanup_all.sh --resource-group -``` - ## Scenarios Deployed by deploy_all.sh ### 1. Basic Single-Origin @@ -143,7 +124,7 @@ az afd endpoint update -g --profile-name --endpoint-name --profile-name --end - **Authentication**: The function trigger is Anonymous; no keys required - **Function response**: Returns plain text and echoes `WEBSITE_HOSTNAME` to help testing multi-origins - **Application Insights**: Disabled by default via `--disable-app-insights` -- **Deployment method**: Azure uses zip deploy; LocalStack uses `funclocal` + `func` publish +- **Deployment method**: zip deploy via the Azure CLI for both Azure and LocalStack - **AFD readiness**: 2–10 minutes typical; check provisioning state: ```bash az afd endpoint show -g --profile-name --endpoint-name --query provisioningState -o tsv @@ -296,3 +276,9 @@ bash ./scripts/cleanup_all.sh --resource-group - Azure Front Door is a global resource; the script uses `Standard_AzureFrontDoor` SKU and links the route to the default domain of the endpoint - The function removes the `/api` prefix so you can call `/john` directly - The deployment uses zip deploy; because the function has no heavy dependencies, it should work without additional build steps. If you add dependencies that require native builds, consider using the Azure Functions Core Tools for publishing + +## References + +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-front-door/python/scripts/deploy_all.sh b/samples/function-app-front-door/python/scripts/deploy_all.sh index bd5d85f..b276402 100644 --- a/samples/function-app-front-door/python/scripts/deploy_all.sh +++ b/samples/function-app-front-door/python/scripts/deploy_all.sh @@ -269,6 +269,8 @@ if [[ "$DO_RULES" == "true" ]]; then RS_STATUS=$? set -e if [[ $RS_STATUS -eq 0 ]]; then + # Rules use the shorthand syntax of the `cdn` CLI extension (>= 1.0.0b1), where + # conditions/actions are passed as structured lists instead of flattened arguments. # Add Rule 1: ModifyResponseHeader when RequestMethod == GET set +e az afd rule create \ @@ -277,15 +279,9 @@ if [[ "$DO_RULES" == "true" ]]; then --rule-set-name "$ruleSetName" \ --rule-name "$ruleName" \ --order 1 \ - --match-variable RequestMethod \ - --operator Equal \ - --match-values GET \ - --negate-condition false \ --match-processing-behavior Continue \ - --action-name ModifyResponseHeader \ - --header-action Overwrite \ - --header-name X-CDN \ - --header-value MSFT -o none + --conditions "[{request-method:{parameters:{operator:Equal,match-values:[GET],negate-condition:false}}}]" \ + --actions "[{modify-response-header:{parameters:{header-action:Overwrite,header-name:X-CDN,value:MSFT}}}]" -o none RULE_STATUS=$? set -e # Add Rule 2: UrlRewrite when UrlPath begins with /api -> / @@ -296,13 +292,9 @@ if [[ "$DO_RULES" == "true" ]]; then --rule-set-name "$ruleSetName" \ --rule-name rule2 \ --order 2 \ - --match-variable UrlPath \ - --operator BeginsWith \ - --match-values /api \ - --negate-condition false \ --match-processing-behavior Continue \ - --action-name UrlRewrite \ - --destination / -o none + --conditions "[{url-path:{parameters:{operator:BeginsWith,match-values:[/api],negate-condition:false}}}]" \ + --actions "[{url-rewrite:{parameters:{source-pattern:/api,destination:/}}}]" -o none set -e # Add Rule 3: UrlRedirect when UrlPath begins with /old -> /new (302 Found) set +e @@ -312,24 +304,21 @@ if [[ "$DO_RULES" == "true" ]]; then --rule-set-name "$ruleSetName" \ --rule-name rule3 \ --order 3 \ - --match-variable UrlPath \ - --operator BeginsWith \ - --match-values /old \ - --negate-condition false \ - --action-name UrlRedirect \ - --redirect-type Found \ - --destination /new -o none + --conditions "[{url-path:{parameters:{operator:BeginsWith,match-values:[/old],negate-condition:false}}}]" \ + --actions "[{url-redirect:{parameters:{redirect-type:Found,custom-path:/new}}}]" -o none set -e else echo "Note: 'az afd rule-set' command group not available; skipping rule creation." RULE_STATUS=1 fi - # Create a route and attach the rule set if created + # Create a route and attach the rule set if created. The cdn CLI extension replaced + # `--rule-sets ` with `--formatted-rule-sets`, which takes resource-id references. if [[ $RS_STATUS -eq 0 ]]; then + RULE_SET_ID=$(az afd rule-set show -g "$RESOURCE_GROUP" --profile-name "$profileName" --rule-set-name "$ruleSetName" --query id -o tsv) az afd route create -g "$RESOURCE_GROUP" --profile-name "$profileName" --endpoint-name "$epRules" --route-name "rt-${prefix}-rules" \ --origin-group "$ogRules" --patterns-to-match '/*' --https-redirect Enabled --supported-protocols Http Https \ - --link-to-default-domain Enabled --forwarding-protocol MatchRequest --rule-sets "$ruleSetName" -o none + --link-to-default-domain Enabled --forwarding-protocol MatchRequest --formatted-rule-sets "[{id:'$RULE_SET_ID'}]" -o none else az afd route create -g "$RESOURCE_GROUP" --profile-name "$profileName" --endpoint-name "$epRules" --route-name "rt-${prefix}-rules" \ --origin-group "$ogRules" --patterns-to-match '/*' --https-redirect Enabled --supported-protocols Http Https \ diff --git a/samples/function-app-managed-identity/python/README.md b/samples/function-app-managed-identity/python/README.md index ac13079..d036783 100644 --- a/samples/function-app-managed-identity/python/README.md +++ b/samples/function-app-managed-identity/python/README.md @@ -25,8 +25,6 @@ The following diagram illustrates the architecture of the solution: ## Security -## Security - This sample demonstrates how to configure an [Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad?tabs=workforce-configuration), specifically an Azure Functions App, to use either a user-assigned identity or a system-assigned identity to acquire a security token from [Microsoft Entra ID](https://learn.microsoft.com/en-us/entra/fundamentals/what-is-entra) for accessing downstream services such as Azure Blob Storage. You must configure the target resource to allow access from your app. For most Azure services, configure the target resource by [creating a role assignment](https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-steps) for the user-assigned or system-assigned managed identity used by the application via Azure role-based access control (Azure RBAC). For more information, see [What is Azure RBAC?](https://learn.microsoft.com/en-us/azure/role-based-access-control/overview) Some services use mechanisms other than Azure role-based access control. To understand how to configure access using an identity, refer to the Azure documentation for each target resource. To learn more about which resources support Microsoft Entra tokens, see [Azure services that support Microsoft Entra authentication](https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities#azure-services-that-support-azure-ad-authentication). @@ -53,7 +51,7 @@ The LocalStack emulator emulates the following services, which are necessary at ## Deployment -Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: +Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: ```bash docker pull localstack/localstack-azure @@ -70,7 +68,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application to LocalStack for Azure using one of these methods: @@ -207,7 +205,6 @@ If everything works as expected, you should see output similar to the following: ```bash ./test.sh -Using azlocal for LocalStack emulator environment. Container [input] already exists. Container [output] already exists. Finished[#############################################################] 100.0000% @@ -239,4 +236,6 @@ You can use [Azure Storage Explorer](https://learn.microsoft.com/en-us/azure/sto - [What is Azure Blob storage?](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-overview) - [What is managed identities for Azure resources?](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview) - [How managed identities for Azure resources work with Azure virtual machines](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-managed-identities-work-vm) -- [LocalStack for Azure](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-managed-identity/python/bicep/README.md b/samples/function-app-managed-identity/python/bicep/README.md index af6ad6f..b2e2883 100644 --- a/samples/function-app-managed-identity/python/bicep/README.md +++ b/samples/function-app-managed-identity/python/bicep/README.md @@ -11,19 +11,25 @@ Before deploying this solution, ensure you have the following tools installed: - [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep): VS Code extension for Bicep language support and IntelliSense - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.13 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -55,7 +61,7 @@ param runtimeVersion = '3.13' The [deploy.sh](deploy.sh) script automates the deployment of all Azure resources and the sample application in a single step. Before running the script, customize the variable values based on your needs. In particular, use the `MANAGED_IDENTITY_TYPE` variable to specify the type of managed identity to provision: `SystemAssigned` or `UserAssigned`. > **Note** -> You can use the `azlocal` CLI as a drop-in replacement for the `az` CLI to direct all commands to the LocalStack for Azure emulator. Alternatively, run `azlocal start-interception` to automatically intercept and redirect all `az` commands to LocalStack. For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +> You can use `lstk az` to proxy Azure CLI commands to the LocalStack for Azure emulator. Alternatively, run `lstk az start-interception` to automatically intercept and redirect all `az` commands to LocalStack. For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/). The [deploy.sh](deploy.sh) script executes the following steps: @@ -74,7 +80,7 @@ The [deploy.sh](deploy.sh) script executes the following steps: ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -91,7 +97,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `bicep` folder: @@ -168,3 +174,5 @@ This will remove all Azure resources created by the CLI deployment script. - [Azure Bicep Documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/) - [Bicep Language Reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-managed-identity/python/scripts/README.md b/samples/function-app-managed-identity/python/scripts/README.md index 3a7f1a0..fa0373c 100644 --- a/samples/function-app-managed-identity/python/scripts/README.md +++ b/samples/function-app-managed-identity/python/scripts/README.md @@ -1,6 +1,6 @@ # Azure CLI Deployment -This directory includes Bash scripts designed for deploying and testing the sample Web App utilizing the `azlocal` CLI. Refer to the [Azure Functions App with Managed Identity](../README.md) guide for details about the sample application. +This directory includes Bash scripts designed for deploying and testing the sample Function App utilizing the `lstk` CLI. Refer to the [Azure Functions App with Managed Identity](../README.md) guide for details about the sample application. ## Prerequisites @@ -10,23 +10,29 @@ Before deploying this solution, ensure you have the following tools installed: - [Visual Studio Code](https://code.visualstudio.com/): Code editor installed on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms) - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.13 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview -This [deploy.sh](deploy.sh) script creates the following Azure resources using Azure CLI commands: +The [user-managed-identity.sh](user-managed-identity.sh) and [system-managed-identity.sh](system-managed-identity.sh) scripts create the following Azure resources using Azure CLI commands: 1. [Azure Storage Account](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview): Provides blob storage with `input` and `output` containers for storing text blobs processed by the function app. 2. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans): Defines the compute resources (CPU, memory, and scaling options) that host the Azure Functions app. @@ -36,7 +42,7 @@ This [deploy.sh](deploy.sh) script creates the following Azure resources using A For more information on the sample application, see [Azure Functions App with Managed Identity](../README.md). -## Provisioning Scriptss +## Provisioning Scripts This sample provides two Bash scripts to streamline the deployment process by automating the provisioning of Azure resources and the sample application: @@ -46,12 +52,12 @@ This sample provides two Bash scripts to streamline the deployment process by au These scripts eliminate manual configuration steps and enable one-command deployment of the entire infrastructure. > [!NOTE] -> You can use the `azlocal` CLI as a drop-in replacement for the `az` CLI to direct all commands to the LocalStack for Azure emulator. Alternatively, run `azlocal start-interception` to automatically intercept and redirect all `az` commands to LocalStack. To revert back to the default behavior and send commands to the Azure cloud, run `azlocal stop-interception`. +> You can use `lstk az` to proxy Azure CLI commands to the LocalStack for Azure emulator. Alternatively, run `lstk az start-interception` to automatically intercept and redirect all `az` commands to LocalStack. To revert back to the default behavior and send commands to the Azure cloud, run `lstk az stop-interception`. ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -68,7 +74,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `scripts` folder: @@ -144,3 +150,5 @@ This will remove all Azure resources created by the CLI deployment script. - [Azure CLI Documentation](https://docs.microsoft.com/en-us/cli/azure/) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-managed-identity/python/terraform/README.md b/samples/function-app-managed-identity/python/terraform/README.md index 26d3733..91ac945 100644 --- a/samples/function-app-managed-identity/python/terraform/README.md +++ b/samples/function-app-managed-identity/python/terraform/README.md @@ -12,18 +12,24 @@ Before deploying this solution, ensure you have the following tools installed: - [Python](https://www.python.org/downloads/): Python runtime (version 3.13 or above) - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -42,7 +48,7 @@ For more information on the sample application, see [Azure Functions App with Ma The [deploy.sh](deploy.sh) script automates the deployment of all Azure resources and the sample application in a single step. Before running the script, customize the variable values based on your needs. In particular, use the `MANAGED_IDENTITY_TYPE` variable to specify the type of managed identity to provision: `SystemAssigned` or `UserAssigned`. > **Note** -> You can use the `azlocal` CLI as a drop-in replacement for the `az` CLI to direct all commands to the LocalStack for Azure emulator. Alternatively, run `azlocal start-interception` to automatically intercept and redirect all `az` commands to LocalStack. Likewise, the `tflocal` is a local replacement for the standard `terraform` CLI, allowing you to run Terraform commands against LocalStack's Azure emulation environment. For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +> You can use `lstk az` to proxy Azure CLI commands to the LocalStack for Azure emulator. Alternatively, run `lstk az start-interception` to automatically intercept and redirect all `az` commands to LocalStack. With interception active, the standard `terraform` CLI also runs against LocalStack's Azure emulation environment, so no separate Terraform wrapper is needed. For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/). The [deploy.sh](deploy.sh) script executes the following steps: @@ -79,7 +85,7 @@ provider "azurerm" { ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -96,7 +102,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `terraform` folder: @@ -172,3 +178,5 @@ This will remove all Azure resources created by the CLI deployment script. - [Terraform Azure Provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-managed-identity/python/terraform/providers.tf b/samples/function-app-managed-identity/python/terraform/providers.tf index 566cfc6..8d561b6 100644 --- a/samples/function-app-managed-identity/python/terraform/providers.tf +++ b/samples/function-app-managed-identity/python/terraform/providers.tf @@ -4,7 +4,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.14.0" + version = "=4.81.0" } } } diff --git a/samples/function-app-service-bus/dotnet/README.md b/samples/function-app-service-bus/dotnet/README.md index 08dd7a9..c178a48 100644 --- a/samples/function-app-service-bus/dotnet/README.md +++ b/samples/function-app-service-bus/dotnet/README.md @@ -1,6 +1,6 @@ # Azure Functions App with Service Bus Messaging -This sample demonstrates how to deploy an [Azure Functions App](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview) on an [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans) that exchanges messages through queues in a [Service Bus](https://learn.microsoft.com/en-us/azure/service-bus/service-bus-overview) namespace. The function app authenticates to Azure resources using a [user-assigned managed identity](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview) and connects to the Service Bus namespace via an [Azure Private Endpoint](https://learn.microsoft.com/azure/private-link/private-endpoint-overview) for secure, private network communication. +This sample demonstrates how to deploy an [Azure Functions App](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview) on an [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans) that exchanges messages through queues in a [Service Bus](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview) namespace. The function app authenticates to Azure resources using a [user-assigned managed identity](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview) and connects to the Service Bus namespace via an [Azure Private Endpoint](https://learn.microsoft.com/azure/private-link/private-endpoint-overview) for secure, private network communication. ## Architecture @@ -34,7 +34,7 @@ The solution is composed of the following Azure resources: 5. [Azure NAT Gateway](https://learn.microsoft.com/azure/nat-gateway/nat-overview): Provides deterministic outbound connectivity and a stable public IP address for the Function App's outbound traffic. Included for architectural completeness; the sample app itself does not call any external services. 6. [Azure Network Security Group](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): Enforces inbound and outbound traffic rules across the virtual network's subnets. 7. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview): Centralizes diagnostic logs and metrics from all resources in the solution, enabling unified querying and analysis across the entire deployment. -8. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview-hosting-plans): Defines the underlying compute tier and scaling behavior for the function app. +8. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans): Defines the underlying compute tier and scaling behavior for the function app. 9. [Azure Functions App](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview): Hosts the sample function app. 10. [Azure Application Insights](https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview): Provides application performance monitoring (APM), collecting and analyzing requests, traces, and metrics generated by the function app to surface performance bottlenecks and failures. 11. [Azure Service Bus](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview): A fully managed enterprise message broker. This namespace hosts the `input` and `output` queues used by the function app to exchange messages asynchronously. @@ -55,7 +55,7 @@ The solution is composed of the following Azure resources: ## Deployment -Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: +Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: ```bash docker pull localstack/localstack-azure @@ -72,7 +72,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application to LocalStack for Azure using one of these methods: @@ -219,4 +219,6 @@ You can also inspect the function app's runtime behavior by viewing the logs of - [Azure Functions Apps Documentation](https://learn.microsoft.com/en-us/azure/app-service/) - [Azure Service Bus](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview) -- [LocalStack for Azure](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-service-bus/dotnet/bicep/README.md b/samples/function-app-service-bus/dotnet/bicep/README.md index 8db8741..1e9cbdc 100644 --- a/samples/function-app-service-bus/dotnet/bicep/README.md +++ b/samples/function-app-service-bus/dotnet/bicep/README.md @@ -10,22 +10,28 @@ Before deploying this solution, ensure you have the following tools installed: - [LocalStack for Azure](https://docs.localstack.cloud/azure/): Local Azure cloud emulator for development and testing - [Visual Studio Code](https://code.visualstudio.com/): Code editor installed on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms) - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Azure Functions Core Tools](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local) is required to build, run, and deploy the Azure Functions app locally - [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep): VS Code extension for Bicep language support and IntelliSense - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [.NET SDK](https://dotnet.microsoft.com/en-us/download) is required to compile and run the C# Azure Functions project - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -47,7 +53,7 @@ The [deploy.sh](deploy.sh) script creates the [Azure Resource Group](https://lea 4. [Azure NAT Gateway](https://learn.microsoft.com/azure/nat-gateway/nat-overview): Provides deterministic outbound connectivity and a stable public IP address for the Function App's outbound traffic. Included for architectural completeness; the sample app itself does not call any external services. 5. [Azure Network Security Group](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): Enforces inbound and outbound traffic rules across the virtual network's subnets. 6. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview): Centralizes diagnostic logs and metrics from all resources in the solution, enabling unified querying and analysis across the entire deployment. -7. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview-hosting-plans): Defines the underlying compute tier and scaling behavior for the function app. +7. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans): Defines the underlying compute tier and scaling behavior for the function app. 8. [Azure Functions App](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview): Hosts the sample function app. 9. [Azure Application Insights](https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview): Provides application performance monitoring (APM), collecting and analyzing requests, traces, and metrics generated by the function app to surface performance bottlenecks and failures. 10. [Azure Service Bus](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview): A fully managed enterprise message broker. This namespace hosts the `input` and `output` queues used by the function app to exchange messages asynchronously. @@ -92,7 +98,7 @@ See [deploy.sh](deploy.sh) for the complete deployment automation. The script pe ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -109,7 +115,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `bicep` folder: @@ -310,4 +316,6 @@ This will remove all Azure resources created by the CLI deployment script. - [Azure Bicep Documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/) - [Bicep Language Reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-service-bus/dotnet/scripts/README.md b/samples/function-app-service-bus/dotnet/scripts/README.md index f48dc57..df2864a 100644 --- a/samples/function-app-service-bus/dotnet/scripts/README.md +++ b/samples/function-app-service-bus/dotnet/scripts/README.md @@ -1,6 +1,6 @@ # Azure CLI Deployment -This directory includes Bash scripts designed for deploying and testing the sample function app utilizing the `azlocal` CLI. For further details about the sample application, refer to the [Azure Functions App with Service Bus Messaging](../README.md). +This directory includes Bash scripts designed for deploying and testing the sample function app utilizing the `lstk` CLI. For further details about the sample application, refer to the [Azure Functions App with Service Bus Messaging](../README.md). ## Prerequisites @@ -10,21 +10,27 @@ Before deploying this solution, ensure you have the following tools installed: - [LocalStack for Azure](https://docs.localstack.cloud/azure/): Local Azure cloud emulator for development and testing - [Visual Studio Code](https://code.visualstudio.com/): Code editor installed on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms) - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Azure Functions Core Tools](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local) is required to build, run, and deploy the Azure Functions app locally - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [.NET SDK](https://dotnet.microsoft.com/en-us/download) is required to compile and run the C# Azure Functions project - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -47,7 +53,7 @@ This [deploy.sh](deploy.sh) script creates the following Azure resources using A 5. [Azure NAT Gateway](https://learn.microsoft.com/azure/nat-gateway/nat-overview): Provides deterministic outbound connectivity and a stable public IP address for the Function App's outbound traffic. Included for architectural completeness; the sample app itself does not call any external services. 6. [Azure Network Security Group](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): Enforces inbound and outbound traffic rules across the virtual network's subnets. 7. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview): Centralizes diagnostic logs and metrics from all resources in the solution, enabling unified querying and analysis across the entire deployment. -8. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview-hosting-plans): Defines the underlying compute tier and scaling behavior for the function app. +8. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans): Defines the underlying compute tier and scaling behavior for the function app. 9. [Azure Functions App](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview): Hosts the sample function app. 10. [Azure Application Insights](https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview): Provides application performance monitoring (APM), collecting and analyzing requests, traces, and metrics generated by the function app to surface performance bottlenecks and failures. 11. [Azure Service Bus](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview): A fully managed enterprise message broker. This namespace hosts the `input` and `output` queues used by the function app to exchange messages asynchronously. @@ -61,7 +67,7 @@ For more information on the sample application, see [Azure Functions App with Se ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -78,7 +84,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `scripts` folder: @@ -278,4 +284,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Azure CLI Documentation](https://docs.microsoft.com/en-us/cli/azure/) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-service-bus/dotnet/scripts/call-http-trigger.sh b/samples/function-app-service-bus/dotnet/scripts/call-http-trigger.sh index 46150fe..1268060 100755 --- a/samples/function-app-service-bus/dotnet/scripts/call-http-trigger.sh +++ b/samples/function-app-service-bus/dotnet/scripts/call-http-trigger.sh @@ -140,7 +140,7 @@ call_http_trigger_function() { if [ -n "$function_host_name" ]; then # Call the GetGreetings HTTP trigger function to retrieve the last greetings via the function hostname echo "Calling HTTP trigger function to retrieve the last [$greeting_count] greetings via function hostname [$function_host_name]..." - curl -s "http://$function_host_name/api/greetings?count=$greeting_count" | jq + curl --max-time 10 -s "http://$function_host_name/api/greetings?count=$greeting_count" | jq else echo "Failed to retrieve function hostname" fi @@ -148,7 +148,7 @@ call_http_trigger_function() { if [ -n "$container_ip" ]; then # Call the GetGreetings HTTP trigger function to retrieve the last greetings via the container IP address echo "Calling HTTP trigger function to retrieve the last [$greeting_count] greetings via container IP address [$container_ip]..." - curl -s "http://$container_ip/api/greetings?count=$greeting_count" | jq + curl --max-time 10 -s "http://$container_ip/api/greetings?count=$greeting_count" | jq else echo "Failed to retrieve container IP address" fi @@ -156,7 +156,7 @@ call_http_trigger_function() { if [ -n "$host_port" ]; then # Call the GetGreetings HTTP trigger function to retrieve the last greetings via the host port echo "Calling HTTP trigger function to retrieve the last [$greeting_count] greetings via host port [$host_port]..." - curl -s "http://localhost:$host_port/api/greetings?count=$greeting_count" | jq + curl --max-time 10 -s "http://localhost:$host_port/api/greetings?count=$greeting_count" | jq else echo "Failed to retrieve host port" fi diff --git a/samples/function-app-service-bus/dotnet/terraform/README.md b/samples/function-app-service-bus/dotnet/terraform/README.md index 075ae28..55c5ccd 100644 --- a/samples/function-app-service-bus/dotnet/terraform/README.md +++ b/samples/function-app-service-bus/dotnet/terraform/README.md @@ -10,22 +10,28 @@ Before deploying this solution, ensure you have the following tools installed: - [LocalStack for Azure](https://docs.localstack.cloud/azure/): Local Azure cloud emulator for development and testing - [Visual Studio Code](https://code.visualstudio.com/): Code editor installed on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms) - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Azure Functions Core Tools](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local) is required to build, run, and deploy the Azure Functions app locally - [Terraform](https://developer.hashicorp.com/terraform/downloads), if you plan to install the sample via Terraform. - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [.NET SDK](https://dotnet.microsoft.com/en-us/download) is required to compile and run the C# Azure Functions project - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -48,7 +54,7 @@ The Terraform modules create the following Azure resources: 5. [Azure NAT Gateway](https://learn.microsoft.com/azure/nat-gateway/nat-overview): Provides deterministic outbound connectivity and a stable public IP address for the Function App's outbound traffic. Included for architectural completeness; the sample app itself does not call any external services. 6. [Azure Network Security Group](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): Enforces inbound and outbound traffic rules across the virtual network's subnets. 7. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview): Centralizes diagnostic logs and metrics from all resources in the solution, enabling unified querying and analysis across the entire deployment. -8. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview-hosting-plans): Defines the underlying compute tier and scaling behavior for the function app. +8. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans): Defines the underlying compute tier and scaling behavior for the function app. 9. [Azure Functions App](https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview): Hosts the sample function app. 10. [Azure Application Insights](https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview): Provides application performance monitoring (APM), collecting and analyzing requests, traces, and metrics generated by the function app to surface performance bottlenecks and failures. 11. [Azure Service Bus](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview): A fully managed enterprise message broker. This namespace hosts the `input` and `output` queues used by the function app to exchange messages asynchronously. @@ -97,7 +103,7 @@ provider "azurerm" { ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -114,7 +120,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `terraform` folder: @@ -314,4 +320,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Terraform Azure Provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-service-bus/dotnet/terraform/providers.tf b/samples/function-app-service-bus/dotnet/terraform/providers.tf index 3e04500..fe17628 100644 --- a/samples/function-app-service-bus/dotnet/terraform/providers.tf +++ b/samples/function-app-service-bus/dotnet/terraform/providers.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.60.0" + version = "=4.81.0" } } } diff --git a/samples/function-app-storage-http/dotnet/README.md b/samples/function-app-storage-http/dotnet/README.md index df835c2..6369726 100644 --- a/samples/function-app-storage-http/dotnet/README.md +++ b/samples/function-app-storage-http/dotnet/README.md @@ -129,13 +129,13 @@ The sample uses the following configurable settings in `local.settings.json`: - [.NET SDK](https://dotnet.microsoft.com/en-us/download) is required to build and run the Azure Functions app written in C#. - [Docker](https://docs.docker.com/get-docker/) necessary as container runtime for LocalStack. - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) necessary to work with LocalStack. -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/) is the LocalStack Azure CLI wrapper. +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) is a high-performance command-line interface for LocalStack. - [jq](https://jqlang.org/) is a JSON processor for scripting. - [Azure Storage Explorer](https://learn.microsoft.com/en-us/azure/storage/storage-explorer/vs-azure-tools-storage-manage-with-storage-explorer) for viewing storage contents. ## Deployment -1. You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +1. You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -221,4 +221,6 @@ Explore the following resources to deepen your understanding of Azure Functions, - [LocalStack for Azure - Introduction](https://azure.localstack.cloud/introduction/) - [LocalStack for Azure - Getting Started](https://azure.localstack.cloud/getting-started/) - [LocalStack for Azure - Azure Functions](https://azure.localstack.cloud/user-guide/azure-functions/) -- [LocalStack for Azure - Storage Services](https://azure.localstack.cloud/user-guide/storage/) \ No newline at end of file +- [LocalStack for Azure - Storage Services](https://azure.localstack.cloud/user-guide/storage/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-storage-http/dotnet/bicep/README.md b/samples/function-app-storage-http/dotnet/bicep/README.md index 9d738a2..fb5aeba 100644 --- a/samples/function-app-storage-http/dotnet/bicep/README.md +++ b/samples/function-app-storage-http/dotnet/bicep/README.md @@ -12,18 +12,24 @@ Before deploying this solution, ensure you have the following tools installed: - [.NET SDK](https://dotnet.microsoft.com/en-us/download): Required for building and publishing the C# Azure Functions application - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -56,7 +62,7 @@ See [deploy.sh](deploy.sh) for the complete deployment automation script. The sc ## Deployment -1. You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +1. You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -72,7 +78,7 @@ See [deploy.sh](deploy.sh) for the complete deployment automation script. The sc 3. Navigate to the scripts directory ```bash - cd samples/function-app-and-storage/dotnet/bicep + cd samples/function-app-storage-http/dotnet/bicep ``` 4. Make the script executable: @@ -156,4 +162,6 @@ This will remove all Azure resources created by the CLI deployment script. - [Bicep Language Reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions) - [Azure Functions Documentation](https://docs.microsoft.com/en-us/azure/azure-functions/) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) -- [Azure Functions Methods Documentation](../src/sample/Methods.md) - Detailed documentation of all implemented functions \ No newline at end of file +- [Azure Functions Methods Documentation](../METHODS.md) - Detailed documentation of all implemented functions +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-storage-http/dotnet/bicep/deploy.sh b/samples/function-app-storage-http/dotnet/bicep/deploy.sh index de5e966..cf41950 100755 --- a/samples/function-app-storage-http/dotnet/bicep/deploy.sh +++ b/samples/function-app-storage-http/dotnet/bicep/deploy.sh @@ -114,9 +114,10 @@ dotnet clean dotnet build -c Release # Publish the project to a publish directory -dotnet publish -c Release -o publish +dotnet publish -c Release -o publish || exit 1 # Create deployment zip from the published output +rm -f $ZIPFILE cd publish || exit zip -r ../$ZIPFILE . cd .. || exit diff --git a/samples/function-app-storage-http/dotnet/bicep/main.bicepparam b/samples/function-app-storage-http/dotnet/bicep/main.bicepparam index eb9aabb..bc5501d 100644 --- a/samples/function-app-storage-http/dotnet/bicep/main.bicepparam +++ b/samples/function-app-storage-http/dotnet/bicep/main.bicepparam @@ -3,4 +3,4 @@ using 'main.bicep' param prefix = 'local' param suffix = 'test' param runtimeName = 'dotnet-isolated' -param runtimeVersion = '9.0' +param runtimeVersion = '10.0' diff --git a/samples/function-app-storage-http/dotnet/scripts/README.md b/samples/function-app-storage-http/dotnet/scripts/README.md index d504480..acc9ad9 100644 --- a/samples/function-app-storage-http/dotnet/scripts/README.md +++ b/samples/function-app-storage-http/dotnet/scripts/README.md @@ -1,6 +1,6 @@ # Azure CLI Deployment -This folder contains Bash scripts for deploying an Azure Functions application with supporting Azure services using the `azlocal` CLI. The deployment creates a complete gaming scoreboard system using Azure Functions and Azure Storage Account with direct Azure CLI commands through the LocalStack Azure emulator. For more information, see [Azure Functions Sample with LocalStack for Azure](../README.md). +This folder contains Bash scripts for deploying an Azure Functions application with supporting Azure services using the `lstk` CLI. The deployment creates a complete gaming scoreboard system using Azure Functions and Azure Storage Account with direct Azure CLI commands through the LocalStack Azure emulator. For more information, see [Azure Functions Sample with LocalStack for Azure](../README.md). ## Prerequisites @@ -11,19 +11,24 @@ Before deploying this solution, ensure you have the following tools installed: - [.NET SDK](https://dotnet.microsoft.com/en-us/download): Required for building and publishing the C# Azure Functions application - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper -- [funclocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Functions Core Tools wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -39,17 +44,18 @@ The system implements a complete gaming scoreboard with multiple Azure Functions See [deploy.sh](deploy.sh) for the complete deployment script. The script performs: -- Detects environment (LocalStack vs Azure Cloud) and selects appropriate CLI - Creates resource group if it doesn't exist - Creates Storage Account and retrieves access key - Creates Function App with consumption plan - Constructs storage connection string - Configures Function App settings (storage, queue, table, timer configurations) -- Publishes the .NET application using `funclocal` or `func azure functionapp publish` +- Builds and publishes the .NET application in Release configuration +- Creates deployment zip package from published output +- Deploys the zip to Azure Function App using `az functionapp deploy` ## Deployment -1. You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +1. You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -65,7 +71,7 @@ See [deploy.sh](deploy.sh) for the complete deployment script. The script perfor 3. Navigate to the scripts directory ```bash - cd samples/function-app-and-storage/dotnet/scripts + cd samples/function-app-storage-http/dotnet/scripts ``` 4. Make the script executable: @@ -92,7 +98,7 @@ PREFIX='myapp' # Change resource name prefix SUFFIX='prod' # Change resource name suffix LOCATION='eastus' # Change deployment region RUNTIME="DOTNET-ISOLATED" # Runtime type -RUNTIME_VERSION="9" # Runtime version +RUNTIME_VERSION="10" # Runtime version ``` ### Application Settings @@ -116,17 +122,17 @@ The script configures the following application settings for the gaming system: ### LocalStack-Specific Commands -1. `azlocal start-interception`: +1. `lstk az start-interception`: - Redirects Azure CLI calls to LocalStack endpoints - Enables local development without Azure subscription - Maintains compatibility with standard Azure CLI syntax -2. `funclocal azure functionapp publish`: - - Deploys function app to LocalStack Azure emulator - - Wraps the Azure Functions Core Tools - - Provides local testing environment for Azure Functions +2. `az functionapp deploy`: + - Deploys the zipped publish output to the function app + - Works identically against LocalStack and Azure + - Uses the standard Azure CLI zip deployment mechanism -3. `azlocal stop-interception`: +3. `lstk az stop-interception`: - Restores normal Azure CLI behavior - Cleans up LocalStack session state - Returns CLI to standard Azure cloud operations @@ -198,5 +204,7 @@ This will remove all Azure resources created by the CLI deployment script. - [Azure CLI Documentation](https://docs.microsoft.com/en-us/cli/azure/) - [Azure Functions CLI Documentation](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local) -- [Azure Functions Methods Documentation](../src/sample/Methods.md) - Detailed documentation of all implemented functions +- [Azure Functions Methods Documentation](../METHODS.md) - Detailed documentation of all implemented functions - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-storage-http/dotnet/scripts/call-http-triggers.sh b/samples/function-app-storage-http/dotnet/scripts/call-http-triggers.sh index 21f4b0d..7409291 100755 --- a/samples/function-app-storage-http/dotnet/scripts/call-http-triggers.sh +++ b/samples/function-app-storage-http/dotnet/scripts/call-http-triggers.sh @@ -141,11 +141,11 @@ call_http_trigger_functions() { if [ -n "$function_host_name" ]; then # Call the GET HTTP trigger function that returns a player status in a specified game session via the function hostname echo "Calling HTTP trigger function to retrieve player [$player_name] status in game session [$game_session] via function hostname [$function_host_name]..." - curl -s "http://$function_host_name/api/player/$game_session/$player_name/status" | jq + curl --max-time 10 -s "http://$function_host_name/api/player/$game_session/$player_name/status" | jq # Call the POST HTTP trigger function that returns the game session details via the function hostname echo "Calling HTTP trigger function to retrieve game session [$game_session] details via function hostname [$function_host_name]..." - curl -s -X POST -H "Content-Type: application/json" -d "{\"gameId\": $game_session}" "http://$function_host_name/api/game/session" | jq + curl --max-time 10 -s -X POST -H "Content-Type: application/json" -d "{\"gameId\": $game_session}" "http://$function_host_name/api/game/session" | jq else echo "Failed to retrieve function hostname" fi @@ -153,11 +153,11 @@ call_http_trigger_functions() { if [ -n "$container_ip" ]; then # Call the GET HTTP trigger function that returns a player status in a specified game session via the container IP address echo "Calling HTTP trigger function to retrieve player [$player_name] status in game session [$game_session] via container IP address [$container_ip]..." - curl -s "http://$container_ip/api/player/$game_session/$player_name/status" | jq + curl --max-time 10 -s "http://$container_ip/api/player/$game_session/$player_name/status" | jq # Call the POST HTTP trigger function that returns the game session details via the container IP address echo "Calling HTTP trigger function to retrieve game session [$game_session] details via container IP address [$container_ip]..." - curl -s -X POST -H "Content-Type: application/json" -d "{\"gameId\": $game_session}" "http://$container_ip/api/game/session" | jq + curl --max-time 10 -s -X POST -H "Content-Type: application/json" -d "{\"gameId\": $game_session}" "http://$container_ip/api/game/session" | jq else echo "Failed to retrieve container IP address" fi @@ -165,11 +165,11 @@ call_http_trigger_functions() { if [ -n "$host_port" ]; then # Call the GET HTTP trigger function that returns a player status in a specified game session via the host port echo "Calling HTTP trigger function to retrieve player [$player_name] status in game session [$game_session] via host port [$host_port]..." - curl -s "http://localhost:$host_port/api/player/$game_session/$player_name/status" | jq + curl --max-time 10 -s "http://localhost:$host_port/api/player/$game_session/$player_name/status" | jq # Call the POST HTTP trigger function that returns the game session details via the host port echo "Calling HTTP trigger function to retrieve game session [$game_session] details via host port [$host_port]..." - curl -s -X POST -H "Content-Type: application/json" -d "{\"gameId\": $game_session}" "http://localhost:$host_port/api/game/session" | jq + curl --max-time 10 -s -X POST -H "Content-Type: application/json" -d "{\"gameId\": $game_session}" "http://localhost:$host_port/api/game/session" | jq else echo "Failed to retrieve host port" fi diff --git a/samples/function-app-storage-http/dotnet/scripts/deploy.sh b/samples/function-app-storage-http/dotnet/scripts/deploy.sh index f4f53b8..8481903 100755 --- a/samples/function-app-storage-http/dotnet/scripts/deploy.sh +++ b/samples/function-app-storage-http/dotnet/scripts/deploy.sh @@ -17,15 +17,13 @@ OUTPUT_QUEUE_NAME="output" TRIGGER_QUEUE_NAME="trigger" INPUT_TABLE_NAME="scoreboards" OUTPUT_TABLE_NAME="winners" +ZIPFILE="function_app.zip" CURRENT_DIR="$(cd "$(dirname "$0")" && pwd)" SUBSCRIPTION_NAME=$(az account show --query name --output tsv) -ENVIRONMENT=$(az account show --query environmentName --output tsv) # Change the current directory to the script's directory cd "$CURRENT_DIR" || exit -FUNC="func" - # Create a resource group echo "Checking if resource group [$RESOURCE_GROUP_NAME] exists in the subscription [$SUBSCRIPTION_NAME]..." az group show --name $RESOURCE_GROUP_NAME &>/dev/null @@ -43,7 +41,7 @@ if [[ $? != 0 ]]; then echo "Resource group [$RESOURCE_GROUP_NAME] successfully created in the subscription [$SUBSCRIPTION_NAME]" else echo "Failed to create resource group [$RESOURCE_GROUP_NAME] in the subscription [$SUBSCRIPTION_NAME]" - exit + exit 1 fi else echo "Resource group [$RESOURCE_GROUP_NAME] already exists in the subscription [$SUBSCRIPTION_NAME]" @@ -141,10 +139,28 @@ fi # CD into the function app directory cd ../src/sample || exit -echo "Publishing function app [$FUNCTION_APP_NAME]..." -if [[ $ENVIRONMENT == "LocalStack" ]]; then - # Disable proxy for NuGet during build to avoid proxy interference - NO_PROXY="api.nuget.org,*.nuget.org" no_proxy="api.nuget.org,*.nuget.org" $FUNC azure functionapp publish $FUNCTION_APP_NAME --dotnet-isolated #--verbose --debug +# Clean and build the project in Release configuration +dotnet clean +dotnet build -c Release + +# Publish the project to a publish directory +dotnet publish -c Release -o publish || exit 1 + +# Create deployment zip from the published output +rm -f $ZIPFILE +cd publish || exit +zip -r ../$ZIPFILE . +cd .. || exit + +# Deploy the function app using the zip file +echo "Deploying function app [$FUNCTION_APP_NAME]..." +if az functionapp deploy \ + --resource-group "$RESOURCE_GROUP_NAME" \ + --name "$FUNCTION_APP_NAME" \ + --src-path $ZIPFILE \ + --type zip 1> /dev/null; then + echo "Function app [$FUNCTION_APP_NAME] deployed successfully." else - $FUNC azure functionapp publish $FUNCTION_APP_NAME --dotnet-isolated #--verbose --debug + echo "Failed to deploy function app [$FUNCTION_APP_NAME]." + exit 1 fi \ No newline at end of file diff --git a/samples/function-app-storage-http/dotnet/src/sample.sln b/samples/function-app-storage-http/dotnet/src/sample.sln index 9001228..79d1756 100644 --- a/samples/function-app-storage-http/dotnet/src/sample.sln +++ b/samples/function-app-storage-http/dotnet/src/sample.sln @@ -8,15 +8,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "obj", "obj", "{CA285D67-BB6 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "release", "release", "{DA95AA47-ED09-4F06-18B9-BFDCCE25247A}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net9.0", "net9.0", "{D41FC5AB-4495-5B85-6815-24C4FBB2A598}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net10.0", "net10.0", "{D41FC5AB-4495-5B85-6815-24C4FBB2A598}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkerExtensions", "obj\release\net9.0\WorkerExtensions\WorkerExtensions.csproj", "{A6C46BF8-FF78-68B4-B4BA-4DEF62E00E32}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkerExtensions", "obj\release\net10.0\WorkerExtensions\WorkerExtensions.csproj", "{A6C46BF8-FF78-68B4-B4BA-4DEF62E00E32}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debug", "Debug", "{3DB07252-4F5B-61B7-192E-6C40720DF607}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net9.0", "net9.0", "{423DF030-E479-861D-2231-1D1BC1956A42}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net10.0", "net10.0", "{423DF030-E479-861D-2231-1D1BC1956A42}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkerExtensions", "obj\Debug\net9.0\WorkerExtensions\WorkerExtensions.csproj", "{AB8BBC52-ADC2-69F9-59E2-D2BFB6E19E3E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkerExtensions", "obj\Debug\net10.0\WorkerExtensions\WorkerExtensions.csproj", "{AB8BBC52-ADC2-69F9-59E2-D2BFB6E19E3E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/samples/function-app-storage-http/dotnet/terraform/README.md b/samples/function-app-storage-http/dotnet/terraform/README.md index a452ff7..9db1b48 100644 --- a/samples/function-app-storage-http/dotnet/terraform/README.md +++ b/samples/function-app-storage-http/dotnet/terraform/README.md @@ -12,18 +12,24 @@ Before deploying this solution, ensure you have the following tools installed: - [.NET SDK](https://dotnet.microsoft.com/en-us/download): Required for building and publishing the C# Azure Functions application - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -40,7 +46,7 @@ The system implements a complete gaming scoreboard with multiple Azure Functions See [deploy.sh](deploy.sh) for the complete deployment automation. The script performs: -- Detects environment (LocalStack vs Azure Cloud) and uses appropriate CLI (`tflocal`/`azlocal` or `terraform`/`az`) +- Runs the standard `terraform` and `az` CLIs (run `lstk az start-interception` beforehand to route all Azure CLI calls to the LocalStack emulator) - Initializes Terraform and downloads required providers - Creates and validates Terraform execution plan with custom variables - Applies Terraform configuration to provision Azure resources @@ -74,7 +80,7 @@ provider "azurerm" { ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -91,13 +97,13 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `terraform` folder: ```bash -cd samples/function-app-managed-identity/python/terraform +cd samples/function-app-storage-http/dotnet/terraform ``` Make the script executable: @@ -180,4 +186,6 @@ This will remove all Azure resources created by the CLI deployment script. - [Azure Functions Documentation](https://docs.microsoft.com/en-us/azure/azure-functions/) - [Terraform Azure Provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) -- [Azure Functions Methods Documentation](../src/sample/Methods.md) - Detailed documentation of all implemented functions \ No newline at end of file +- [Azure Functions Methods Documentation](../METHODS.md) - Detailed documentation of all implemented functions +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/function-app-storage-http/dotnet/terraform/deploy.sh b/samples/function-app-storage-http/dotnet/terraform/deploy.sh index 5a9e069..6578b8f 100755 --- a/samples/function-app-storage-http/dotnet/terraform/deploy.sh +++ b/samples/function-app-storage-http/dotnet/terraform/deploy.sh @@ -45,9 +45,10 @@ dotnet clean dotnet build -c Release # Publish the project to a publish directory -dotnet publish -c Release -o publish +dotnet publish -c Release -o publish || exit 1 # Create deployment zip from the published output +rm -f $ZIPFILE cd publish || exit zip -r ../$ZIPFILE . cd .. || exit diff --git a/samples/function-app-storage-http/dotnet/terraform/providers.tf b/samples/function-app-storage-http/dotnet/terraform/providers.tf index 566cfc6..8d561b6 100644 --- a/samples/function-app-storage-http/dotnet/terraform/providers.tf +++ b/samples/function-app-storage-http/dotnet/terraform/providers.tf @@ -4,7 +4,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.14.0" + version = "=4.81.0" } } } diff --git a/samples/function-app-storage-http/dotnet/terraform/terraform.tfvars b/samples/function-app-storage-http/dotnet/terraform/terraform.tfvars index ca69f79..0698a62 100644 --- a/samples/function-app-storage-http/dotnet/terraform/terraform.tfvars +++ b/samples/function-app-storage-http/dotnet/terraform/terraform.tfvars @@ -1,4 +1,4 @@ prefix = "funchttp" location = "westeurope" runtime_name = "dotnet-isolated" -dotnet_version = "9.0" \ No newline at end of file +dotnet_version = "10.0" \ No newline at end of file diff --git a/samples/function-app-storage-http/dotnet/terraform/variables.tf b/samples/function-app-storage-http/dotnet/terraform/variables.tf index b18929d..059897b 100644 --- a/samples/function-app-storage-http/dotnet/terraform/variables.tf +++ b/samples/function-app-storage-http/dotnet/terraform/variables.tf @@ -161,15 +161,16 @@ variable "runtime_name" { variable "dotnet_version" { description = "(Optional) Specifies the .NET version for the Azure Functions App." type = string - default = "9.0" + default = "10.0" validation { condition = contains([ "6.0", "8.0", - "9.0" + "9.0", + "10.0" ], var.dotnet_version) - error_message = "The dotnet_version must be one of the supported versions: 6.0, 8.0, 9.0." + error_message = "The dotnet_version must be one of the supported versions: 6.0, 8.0, 9.0, 10.0." } } diff --git a/samples/servicebus/java/README.md b/samples/servicebus/java/README.md index bb9acee..a4b3fed 100644 --- a/samples/servicebus/java/README.md +++ b/samples/servicebus/java/README.md @@ -20,7 +20,7 @@ The solution is composed of the following Azure resources: - [Azure Subscription](https://azure.microsoft.com/free/) - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Java 21+](https://learn.microsoft.com/en-us/java/openjdk/download) - [Maven 3.8+](https://maven.apache.org/download.cgi) - [Terraform](https://developer.hashicorp.com/terraform/downloads), if you plan to deploy the sample via Terraform. @@ -45,14 +45,14 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application to LocalStack for Azure using one of these methods: -- [Azure CLI Deployment](./java/scripts/deploy.sh) -- [Bicep Deployment](./java/bicep/deploy.sh) -- [Terraform Deployment](./java/terraform/deploy.sh) +- [Azure CLI Deployment](./scripts/deploy.sh) +- [Bicep Deployment](./bicep/deploy.sh) +- [Terraform Deployment](./terraform/deploy.sh) All deployment methods have been fully tested against Azure and the LocalStack for Azure local emulator. @@ -83,5 +83,5 @@ The application then: - [Azure Service Bus Queues](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-queues-topics-subscriptions) - [Spring Boot Starter for Azure Service Bus](https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/spring-cloud-azure) - [LocalStack for Azure](https://docs.localstack.cloud/azure/) - - +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/servicebus/java/bicep/README.md b/samples/servicebus/java/bicep/README.md index f34c888..1662a12 100644 --- a/samples/servicebus/java/bicep/README.md +++ b/samples/servicebus/java/bicep/README.md @@ -1,6 +1,6 @@ # Bicep Deployment -This directory contains a Bicep template and a deployment script for provisioning Azure services in LocalStack for Azure. For further details about the sample application, refer to the [Azure Service Bus with Spring Boot](../../README.md). +This directory contains a Bicep template and a deployment script for provisioning Azure services in LocalStack for Azure. For further details about the sample application, refer to the [Azure Service Bus with Spring Boot](../README.md). ## Prerequisites @@ -11,20 +11,26 @@ Before deploying this solution, ensure you have the following tools installed: - [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep): VS Code extension for Bicep language support and IntelliSense - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Java 21+](https://learn.microsoft.com/en-us/java/openjdk/download): Java runtime for compiling and running the sample application - [Maven 3.8+](https://maven.apache.org/download.cgi): Build tool for managing Java project dependencies and compilation - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -34,7 +40,7 @@ The [deploy.sh](deploy.sh) script creates the [Azure Resource Group](https://lea 2. [Azure Service Bus Namespace](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview): The messaging namespace that hosts the queue used by the application. 3. [Azure Service Bus Queue](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-queues-topics-subscriptions#queues): The `myqueue` queue used to send and receive messages. -The Spring Boot sample application connects to the Service Bus namespace, sends a test message to the sample queue, receives it back, and exits. For more information on the sample application, see [Azure Service Bus with Spring Boot](../../README.md). +The Spring Boot sample application connects to the Service Bus namespace, sends a test message to the sample queue, receives it back, and exits. For more information on the sample application, see [Azure Service Bus with Spring Boot](../README.md). ## Configuration @@ -83,7 +89,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `bicep` folder: @@ -118,15 +124,6 @@ RESOURCE_GROUP_NAME="${PREFIX}-rg" SERVICEBUS_NAMESPACE_NAME="${PREFIX}-sb-ns-${SUFFIX}" SERVICEBUS_QUEUE_NAME="myqueue" -# Choose the appropriate CLI based on the environment -if [[ $ENVIRONMENT == "LocalStack" ]]; then - echo "Using azlocal for LocalStack emulator environment." - AZ="azlocal" -else - echo "Using standard az for AzureCloud environment." - AZ="az" -fi - # Check resource group echo -e "[$RESOURCE_GROUP_NAME] resource group:\n" az group show \ @@ -179,4 +176,6 @@ This will remove all Azure resources created by the Bicep deployment script. - [Azure Bicep Documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/) - [Bicep Language Reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/servicebus/java/scripts/README.md b/samples/servicebus/java/scripts/README.md index 4695104..e63cf28 100644 --- a/samples/servicebus/java/scripts/README.md +++ b/samples/servicebus/java/scripts/README.md @@ -1,6 +1,6 @@ # Azure CLI Deployment -This directory contains Azure CLI scripts and a deployment script for provisioning Azure services in LocalStack for Azure. For further details about the sample application, refer to the [Azure Service Bus with Spring Boot](../../README.md). +This directory contains Azure CLI scripts and a deployment script for provisioning Azure services in LocalStack for Azure. For further details about the sample application, refer to the [Azure Service Bus with Spring Boot](../README.md). ## Prerequisites @@ -10,20 +10,26 @@ Before deploying this solution, ensure you have the following tools installed: - [Visual Studio Code](https://code.visualstudio.com/): Code editor installed on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms) - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Java 21+](https://learn.microsoft.com/en-us/java/openjdk/download): Java runtime for compiling and running the sample application - [Maven 3.8+](https://maven.apache.org/download.cgi): Build tool for managing Java project dependencies and compilation - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -33,7 +39,7 @@ The Azure CLI scripts create the following Azure resources: 2. [Azure Service Bus Namespace](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview): The messaging namespace that hosts the queue used by the application. 3. [Azure Service Bus Queue](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-queues-topics-subscriptions#queues): The `myqueue` queue used to send and receive messages. -The Spring Boot sample application connects to the Service Bus namespace, sends a test message to the sample queue, receives it back, and exits. For more information on the sample application, see [Azure Service Bus with Spring Boot](../../README.md). +The Spring Boot sample application connects to the Service Bus namespace, sends a test message to the sample queue, receives it back, and exits. For more information on the sample application, see [Azure Service Bus with Spring Boot](../README.md). ## Provisioning Scripts @@ -66,7 +72,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `scripts` folder: @@ -101,15 +107,6 @@ RESOURCE_GROUP_NAME="${PREFIX}-rg" SERVICEBUS_NAMESPACE_NAME="${PREFIX}-sb-ns-${SUFFIX}" SERVICEBUS_QUEUE_NAME="myqueue" -# Choose the appropriate CLI based on the environment -if [[ $ENVIRONMENT == "LocalStack" ]]; then - echo "Using azlocal for LocalStack emulator environment." - AZ="azlocal" -else - echo "Using standard az for AzureCloud environment." - AZ="az" -fi - # Check resource group echo -e "[$RESOURCE_GROUP_NAME] resource group:\n" az group show \ @@ -161,4 +158,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Azure CLI Documentation](https://docs.microsoft.com/en-us/cli/azure/) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/servicebus/java/terraform/README.md b/samples/servicebus/java/terraform/README.md index 8b3cfd6..c2b31f7 100644 --- a/samples/servicebus/java/terraform/README.md +++ b/samples/servicebus/java/terraform/README.md @@ -11,20 +11,26 @@ Before deploying this solution, ensure you have the following tools installed: - [Terraform](https://developer.hashicorp.com/terraform/downloads): Infrastructure as Code tool for provisioning Azure resources - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Java 21+](https://learn.microsoft.com/en-us/java/openjdk/download): Java runtime for compiling and running the sample application - [Maven 3.8+](https://maven.apache.org/download.cgi): Build tool for managing Java project dependencies and compilation - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -72,7 +78,7 @@ provider "azurerm" { ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -89,7 +95,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `terraform` folder: @@ -124,15 +130,6 @@ RESOURCE_GROUP_NAME="${PREFIX}-rg" SERVICEBUS_NAMESPACE_NAME="${PREFIX}-sb-ns-${SUFFIX}" SERVICEBUS_QUEUE_NAME="myqueue" -# Choose the appropriate CLI based on the environment -if [[ $ENVIRONMENT == "LocalStack" ]]; then - echo "Using azlocal for LocalStack emulator environment." - AZ="azlocal" -else - echo "Using standard az for AzureCloud environment." - AZ="az" -fi - # Check resource group echo -e "[$RESOURCE_GROUP_NAME] resource group:\n" az group show \ @@ -184,4 +181,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Terraform Azure Provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/servicebus/java/terraform/providers.tf b/samples/servicebus/java/terraform/providers.tf index 3e04500..fe17628 100644 --- a/samples/servicebus/java/terraform/providers.tf +++ b/samples/servicebus/java/terraform/providers.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.60.0" + version = "=4.81.0" } } } diff --git a/samples/web-app-cosmosdb-mongodb-api/python/README.md b/samples/web-app-cosmosdb-mongodb-api/python/README.md index 1e1d7e9..80ffb4a 100644 --- a/samples/web-app-cosmosdb-mongodb-api/python/README.md +++ b/samples/web-app-cosmosdb-mongodb-api/python/README.md @@ -38,7 +38,7 @@ The web app enables users to plan and manage vacation activities, with all data ## Deployment -Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: +Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: ```bash docker pull localstack/localstack-azure @@ -55,7 +55,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application to LocalStack for Azure using one of these methods: @@ -88,8 +88,6 @@ You can use the `call-web-app.sh` Bash script below to call the web app. The scr You can utilize [MongoDB Compass](https://www.mongodb.com/try/download/compass) to explore and manage your MongoDB databases and collections. Ensure you connect using `mongodb://localhost:port` connection string, where `port` corresponds to the port published by the MongoDB container on the host and mapped to the internal MongoDB port `27017`. -![MongoDB Compass](./images/mongodb-compass.png) - Alternatively, you can use the [MongoDB Shell](https://www.mongodb.com/docs/mongodb-shell/) to interact with and administer your MongoDB instance, as shown in the following table: ```bash @@ -148,6 +146,8 @@ sampledb> db.activities.find().pretty() - [Azure Web Apps Documentation](https://learn.microsoft.com/en-us/azure/app-service/) - [Azure CosmosDB for MongoDB API](https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/introduction) - [Quickstart: Python Flask on Azure](https://learn.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=flask%2Cbrowser) -- [Quickstart: CosmosDB for MongoDB](https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/quickstart?tabs=azure-portal) +- [Quickstart: CosmosDB for MongoDB](https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/quickstart-python) - [Azure Identity Client Library for Python](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python) -- [LocalStack for Azure](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-cosmosdb-mongodb-api/python/bicep/README.md b/samples/web-app-cosmosdb-mongodb-api/python/bicep/README.md index 6c7e24b..086e2cd 100644 --- a/samples/web-app-cosmosdb-mongodb-api/python/bicep/README.md +++ b/samples/web-app-cosmosdb-mongodb-api/python/bicep/README.md @@ -11,19 +11,25 @@ Before deploying this solution, ensure you have the following tools installed: - [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep): VS Code extension for Bicep language support and IntelliSense - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.12 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -79,7 +85,7 @@ See [deploy.sh](deploy.sh) for the complete deployment automation. The script pe ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -96,7 +102,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `bicep` folder: @@ -276,4 +282,6 @@ This will remove all Azure resources created by the CLI deployment script. - [Azure Bicep Documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/) - [Bicep Language Reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-cosmosdb-mongodb-api/python/scripts/README.md b/samples/web-app-cosmosdb-mongodb-api/python/scripts/README.md index 7547a75..19e7dbe 100644 --- a/samples/web-app-cosmosdb-mongodb-api/python/scripts/README.md +++ b/samples/web-app-cosmosdb-mongodb-api/python/scripts/README.md @@ -1,6 +1,6 @@ # Azure CLI Deployment -This directory includes Bash scripts designed for deploying and testing the sample Web App utilizing the `azlocal` CLI. For further details about the sample application, refer to the [Azure Web App with Azure CosmosDB for MongoDB](../README.md). +This directory includes Bash scripts designed for deploying and testing the sample Web App utilizing the `lstk` CLI. For further details about the sample application, refer to the [Azure Web App with Azure CosmosDB for MongoDB](../README.md). ## Prerequisites @@ -10,19 +10,25 @@ Before deploying this solution, ensure you have the following tools installed: - [Visual Studio Code](https://code.visualstudio.com/): Code editor installed on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms) - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.12 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -64,7 +70,7 @@ See [deploy.sh](deploy.sh) for the complete deployment script. The script perfor ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -81,7 +87,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `scripts` folder: @@ -260,4 +266,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Azure CLI Documentation](https://docs.microsoft.com/en-us/cli/azure/) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-cosmosdb-mongodb-api/python/scripts/call-web-app.sh b/samples/web-app-cosmosdb-mongodb-api/python/scripts/call-web-app.sh index 075a3b4..45e5ad2 100755 --- a/samples/web-app-cosmosdb-mongodb-api/python/scripts/call-web-app.sh +++ b/samples/web-app-cosmosdb-mongodb-api/python/scripts/call-web-app.sh @@ -136,12 +136,12 @@ call_web_app() { fi # Retrieve LocalStack proxy port - proxy_port=$(curl http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') + proxy_port=$(curl --max-time 10 http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') if [ -n "$proxy_port" ]; then # Call the web app via emulator proxy echo "Calling web app [$web_app_name] via emulator..." - curl --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via emulator proxy port [$proxy_port] succeeded." @@ -155,7 +155,7 @@ call_web_app() { if [ -n "$container_ip" ]; then # Call the web app via the container IP address echo "Calling web app [$web_app_name] via container IP address [$container_ip]..." - curl -s "http://$container_ip/" 1> /dev/null + curl --max-time 10 -s "http://$container_ip/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via container IP address [$container_ip] succeeded." @@ -169,7 +169,7 @@ call_web_app() { if [ -n "$host_port" ]; then # Call the web app via the host port echo "Calling web app [$web_app_name] via host port [$host_port]..." - curl -s "http://127.0.0.1:$host_port/" 1> /dev/null + curl --max-time 10 -s "http://127.0.0.1:$host_port/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via host port [$host_port] succeeded." @@ -183,7 +183,7 @@ call_web_app() { if [ -n "$app_host_name" ]; then # Call the web app via the default hostname echo "Calling web app [$web_app_name] via default hostname [$app_host_name]..." - curl -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via default hostname [$app_host_name] succeeded." diff --git a/samples/web-app-cosmosdb-mongodb-api/python/terraform/README.md b/samples/web-app-cosmosdb-mongodb-api/python/terraform/README.md index 1ee62f8..4ccf1c2 100644 --- a/samples/web-app-cosmosdb-mongodb-api/python/terraform/README.md +++ b/samples/web-app-cosmosdb-mongodb-api/python/terraform/README.md @@ -11,19 +11,25 @@ Before deploying this solution, ensure you have the following tools installed: - [Terraform](https://developer.hashicorp.com/terraform/downloads): Infrastructure as Code tool for provisioning Azure resources - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.12 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -84,7 +90,7 @@ provider "azurerm" { ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -101,7 +107,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `terraform` folder: @@ -280,4 +286,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Terraform Azure Provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-cosmosdb-mongodb-api/python/terraform/providers.tf b/samples/web-app-cosmosdb-mongodb-api/python/terraform/providers.tf index 7406526..6a4121d 100644 --- a/samples/web-app-cosmosdb-mongodb-api/python/terraform/providers.tf +++ b/samples/web-app-cosmosdb-mongodb-api/python/terraform/providers.tf @@ -1,7 +1,11 @@ terraform { required_providers { azurerm = { - source = "hashicorp/azurerm" + source = "hashicorp/azurerm" + # Pinned below 4.81.0: with azurerm 4.81 the Cosmos DB Mongo collection + # create/get requests hang against the current LocalStack Azure emulator + # (requests never complete, so the apply times out after 30 minutes). + # Bump back to =4.81.0 once the emulator handles the newer call pattern. version = "=4.60.0" } } @@ -17,7 +21,7 @@ provider "azurerm" { # Set the hostname of the Azure Metadata Service (for example management.azure.com) # used to obtain the Cloud Environment when using LocalStack's Azure emulator. # This allows the provider to correctly identify the environment and avoid making calls to the real Azure endpoints. - metadata_host="localhost.localstack.cloud:4566" + metadata_host = "localhost.localstack.cloud:4566" # Set the subscription ID to a dummy value when using LocalStack's Azure emulator. subscription_id = "00000000-0000-0000-0000-000000000000" diff --git a/samples/web-app-cosmosdb-nosql-api/python/README.md b/samples/web-app-cosmosdb-nosql-api/python/README.md index 3938f9d..b9b2818 100644 --- a/samples/web-app-cosmosdb-nosql-api/python/README.md +++ b/samples/web-app-cosmosdb-nosql-api/python/README.md @@ -21,7 +21,7 @@ The following diagram illustrates the architecture of the solution: ## Deployment -Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: +Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: ```bash docker pull localstack/localstack-azure @@ -38,7 +38,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application to LocalStack for Azure using: @@ -75,4 +75,6 @@ You can utilize **CosmosDB Data Explorer** to explore and manage your CosmosDB d - [Azure CosmosDB Documentation](https://learn.microsoft.com/en-us/azure/cosmos-db/) - [Quickstart: Python Flask on Azure](https://learn.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=flask%2Cbrowser) - [Azure Identity Client Library for Python](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python) -- [LocalStack for Azure](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-cosmosdb-nosql-api/python/scripts/README.md b/samples/web-app-cosmosdb-nosql-api/python/scripts/README.md index 7e06a70..7dba117 100644 --- a/samples/web-app-cosmosdb-nosql-api/python/scripts/README.md +++ b/samples/web-app-cosmosdb-nosql-api/python/scripts/README.md @@ -1,6 +1,6 @@ # Azure CLI Deployment -This directory includes Bash scripts designed for deploying and testing the sample Web App utilizing the `azlocal` CLI. For further details about the sample application, refer to the [Azure Web App with Azure CosmosDB for NoSQL API](../README.md). +This directory includes Bash scripts designed for deploying and testing the sample Web App utilizing the `lstk` CLI. For further details about the sample application, refer to the [Azure Web App with Azure CosmosDB for NoSQL API](../README.md). ## Prerequisites @@ -10,23 +10,29 @@ Before deploying this solution, ensure you have the following tools installed: - [Visual Studio Code](https://code.visualstudio.com/): Code editor installed on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms) - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.12 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The deployment script uses the `azlocal` CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -43,7 +49,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `scripts` folder: @@ -137,4 +143,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Azure CLI Documentation](https://docs.microsoft.com/en-us/cli/azure/) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-cosmosdb-nosql-api/python/scripts/call-web-app.sh b/samples/web-app-cosmosdb-nosql-api/python/scripts/call-web-app.sh index 5f79052..a82964c 100755 --- a/samples/web-app-cosmosdb-nosql-api/python/scripts/call-web-app.sh +++ b/samples/web-app-cosmosdb-nosql-api/python/scripts/call-web-app.sh @@ -137,12 +137,12 @@ call_web_app() { fi # Retrieve LocalStack proxy port - proxy_port=$(curl http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') + proxy_port=$(curl --max-time 10 http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') if [ -n "$proxy_port" ]; then # Call the web app via emulator proxy echo "Calling web app [$web_app_name] via emulator..." - curl --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via emulator proxy port [$proxy_port] succeeded." @@ -156,7 +156,7 @@ call_web_app() { if [ -n "$container_ip" ]; then # Call the web app via the container IP address echo "Calling web app [$web_app_name] via container IP address [$container_ip]..." - curl -s "http://$container_ip/" 1> /dev/null + curl --max-time 10 -s "http://$container_ip/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via container IP address [$container_ip] succeeded." @@ -170,7 +170,7 @@ call_web_app() { if [ -n "$host_port" ]; then # Call the web app via the host port echo "Calling web app [$web_app_name] via host port [$host_port]..." - curl -s "http://127.0.0.1:$host_port/" 1> /dev/null + curl --max-time 10 -s "http://127.0.0.1:$host_port/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via host port [$host_port] succeeded." @@ -184,7 +184,7 @@ call_web_app() { if [ -n "$app_host_name" ]; then # Call the web app via the default hostname echo "Calling web app [$web_app_name] via default hostname [$app_host_name]..." - curl -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via default hostname [$app_host_name] succeeded." diff --git a/samples/web-app-custom-image/python/README.md b/samples/web-app-custom-image/python/README.md index edbf301..0b96468 100644 --- a/samples/web-app-custom-image/python/README.md +++ b/samples/web-app-custom-image/python/README.md @@ -31,12 +31,12 @@ The solution is composed of the following Azure resources: - [Docker](https://docs.docker.com/get-docker/) - [Bicep](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep), if you plan to install the sample via Bicep. - [Terraform](https://developer.hashicorp.com/terraform/downloads), if you plan to install the sample via Terraform. -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs ## Deployment -Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: +Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: ```bash docker pull localstack/localstack-azure @@ -53,7 +53,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application to LocalStack for Azure using one of these methods: @@ -78,3 +78,5 @@ You can use the `call-web-app.sh` Bash script below to call the web app. The scr - [Configure a custom container for Azure App Service](https://learn.microsoft.com/azure/app-service/configure-custom-container?tabs=debian&pivots=container-linux) - [Azure Identity Client Library for Python](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python) - [LocalStack for Azure](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-custom-image/python/bicep/README.md b/samples/web-app-custom-image/python/bicep/README.md index 02b9d4e..857737c 100644 --- a/samples/web-app-custom-image/python/bicep/README.md +++ b/samples/web-app-custom-image/python/bicep/README.md @@ -11,18 +11,24 @@ Before deploying this solution, ensure you have the following tools installed: - [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep): VS Code extension for Bicep language support and IntelliSense - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack and building the custom image - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -88,7 +94,7 @@ See [deploy.sh](deploy.sh) for the complete deployment automation. The script pe ## Deployment -You can set up the Azure emulator by utilizing the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -105,7 +111,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `bicep` folder: @@ -283,4 +289,6 @@ This will remove all Azure resources created by the Bicep deployment script. - [Azure Bicep Documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/) - [Bicep Language Reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-custom-image/python/scripts/README.md b/samples/web-app-custom-image/python/scripts/README.md index 9ddf641..9be415d 100644 --- a/samples/web-app-custom-image/python/scripts/README.md +++ b/samples/web-app-custom-image/python/scripts/README.md @@ -9,18 +9,24 @@ Before deploying this solution, ensure you have the following tools installed: - [LocalStack for Azure](https://docs.localstack.cloud/azure/): Local Azure cloud emulator for development and testing - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack and building the custom image - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -53,7 +59,7 @@ See [deploy.sh](deploy.sh) for the complete deployment automation. The script pe ## Deployment -You can set up the Azure emulator by utilizing the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -70,7 +76,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `scripts` folder: @@ -248,3 +254,5 @@ This will remove all Azure resources created by the Azure CLI deployment script. - [Azure CLI Documentation](https://learn.microsoft.com/en-us/cli/azure/) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-custom-image/python/scripts/call-web-app.sh b/samples/web-app-custom-image/python/scripts/call-web-app.sh index bff883f..9189998 100755 --- a/samples/web-app-custom-image/python/scripts/call-web-app.sh +++ b/samples/web-app-custom-image/python/scripts/call-web-app.sh @@ -32,5 +32,5 @@ fi echo "Web App hostname: $APP_HOST_NAME" echo "Calling Web App using $APP_HOST_NAME..." -curl -fsS "http://$APP_HOST_NAME/api/status" +curl --max-time 10 -fsS "http://$APP_HOST_NAME/api/status" echo "" diff --git a/samples/web-app-custom-image/python/terraform/README.md b/samples/web-app-custom-image/python/terraform/README.md index c771714..c8a1c18 100644 --- a/samples/web-app-custom-image/python/terraform/README.md +++ b/samples/web-app-custom-image/python/terraform/README.md @@ -11,19 +11,25 @@ Before deploying this solution, ensure you have the following tools installed: - [Terraform](https://developer.hashicorp.com/terraform/downloads): Infrastructure as Code tool for provisioning Azure resources - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack and building the custom image - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.12 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -81,7 +87,7 @@ provider "azurerm" { ## Deployment -You can set up the Azure emulator by utilizing the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -98,7 +104,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `terraform` folder: @@ -277,4 +283,5 @@ This will remove all Azure resources created by the Terraform deployment. - [Terraform Azure Provider Documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs) - [Terraform local-exec Provisioner](https://developer.hashicorp.com/terraform/language/resources/provisioners/local-exec) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) - +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-custom-image/python/terraform/providers.tf b/samples/web-app-custom-image/python/terraform/providers.tf index e9f72ea..22bdbb6 100644 --- a/samples/web-app-custom-image/python/terraform/providers.tf +++ b/samples/web-app-custom-image/python/terraform/providers.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.60.0" + version = "=4.81.0" } null = { source = "hashicorp/null" diff --git a/samples/web-app-managed-identity/python/README.md b/samples/web-app-managed-identity/python/README.md index 10cca69..7912751 100644 --- a/samples/web-app-managed-identity/python/README.md +++ b/samples/web-app-managed-identity/python/README.md @@ -49,7 +49,7 @@ The LocalStack emulator emulates the following services, which are necessary at ## Deployment -Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: +Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: ```bash docker pull localstack/localstack-azure @@ -66,7 +66,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application to LocalStack for Azure using one of these methods: @@ -116,3 +116,5 @@ You can use [Azure Storage Explorer](https://learn.microsoft.com/en-us/azure/sto - [What is managed identities for Azure resources?](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview) - [How managed identities for Azure resources work with Azure virtual machines](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-managed-identities-work-vm) - [LocalStack for Azure](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-managed-identity/python/bicep/README.md b/samples/web-app-managed-identity/python/bicep/README.md index d916da0..9b4ee5e 100644 --- a/samples/web-app-managed-identity/python/bicep/README.md +++ b/samples/web-app-managed-identity/python/bicep/README.md @@ -11,19 +11,25 @@ Before deploying this solution, ensure you have the following tools installed: - [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep): VS Code extension for Bicep language support and IntelliSense - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.12 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -54,7 +60,7 @@ See [deploy.sh](deploy.sh) for the complete deployment script. The script perfor ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -71,7 +77,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `bicep` folder: @@ -184,4 +190,6 @@ This will remove all Azure resources created by the CLI deployment script. - [Azure Bicep Documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/) - [Bicep Language Reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-managed-identity/python/scripts/README.md b/samples/web-app-managed-identity/python/scripts/README.md index 55d536a..502feda 100644 --- a/samples/web-app-managed-identity/python/scripts/README.md +++ b/samples/web-app-managed-identity/python/scripts/README.md @@ -1,6 +1,6 @@ # Azure CLI Deployment -This directory includes Bash scripts designed for deploying and testing the sample Web App utilizing the `azlocal` CLI. Refer to the [Azure Web App with Managed Identity](../README.md) guide for details about the sample application. +This directory includes Bash scripts designed for deploying and testing the sample Web App utilizing the `lstk` CLI. Refer to the [Azure Web App with Managed Identity](../README.md) guide for details about the sample application. ## Prerequisites @@ -10,23 +10,29 @@ Before deploying this solution, ensure you have the following tools installed: - [Visual Studio Code](https://code.visualstudio.com/): Code editor installed on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms) - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.12 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview -The [deploy.sh](deploy.sh) Bash script creates the following Azure resources using Azure CLI commands: +The [user-assigned.sh](user-assigned.sh) and [system-assigned.sh](system-assigned.sh) Bash scripts create the following Azure resources using Azure CLI commands: 1. [Azure Storage Account](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview): Provides blob storage for persisting vacation activity data. The web application stores each activity as a JSON blob file in the `activities` container. 2. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans): Defines the compute resources (CPU, memory, and scaling options) that host the web application. @@ -66,11 +72,11 @@ See the script files for complete implementation. The scripts perform the follow These scripts eliminate manual configuration steps and enable one-command deployment of the entire infrastructure. > [!NOTE] -> You can use the `azlocal` CLI as a drop-in replacement for the `az` CLI to direct all commands to the LocalStack for Azure emulator. Alternatively, run `azlocal start-interception` to automatically intercept and redirect all `az` commands to LocalStack. To revert back to the default behavior and send commands to the Azure cloud, run `azlocal stop-interception`. +> You can use `lstk az` to proxy Azure CLI commands to the LocalStack for Azure emulator. Alternatively, run `lstk az start-interception` to automatically intercept and redirect all `az` commands to LocalStack. To revert back to the default behavior and send commands to the Azure cloud, run `lstk az stop-interception`. ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -87,7 +93,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `scripts` folder: @@ -200,3 +206,5 @@ This will remove all Azure resources created by the CLI deployment script. - [Azure CLI Documentation](https://docs.microsoft.com/en-us/cli/azure/) - [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-managed-identity/python/scripts/api.sh b/samples/web-app-managed-identity/python/scripts/api.sh index 3c56ce0..71c0deb 100755 --- a/samples/web-app-managed-identity/python/scripts/api.sh +++ b/samples/web-app-managed-identity/python/scripts/api.sh @@ -10,7 +10,7 @@ MANAGED_IDENTITY_NAME="${PREFIX}-identity-${SUFFIX}-${RANDOM_SUFFIX}" RESOURCE_GROUP_NAME="${PREFIX}-rg" SUBSCRIPTION_NAME=$(az account show --query name --output tsv) SUBSCRIPTION_ID=$(az account show --query id --output tsv) -PROXY_PORT=$(curl http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') +PROXY_PORT=$(curl --max-time 10 http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') SUB_BASE_URL="https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/providers/Microsoft.ManagedIdentity/userAssignedIdentities" RG_BASE_URL="https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP_NAME/providers/Microsoft.ManagedIdentity/userAssignedIdentities" ENVIRONMENT=$(az account show --query environmentName --output tsv) @@ -18,9 +18,9 @@ API_VERSION="2024-11-30" # Choose the appropriate CLI based on the environment if [[ $ENVIRONMENT == "LocalStack" ]]; then - CURL="env http_proxy=http://127.0.0.1:$PROXY_PORT https_proxy=http://127.0.0.1:$PROXY_PORT curl -k -s" + CURL="env http_proxy=http://127.0.0.1:$PROXY_PORT https_proxy=http://127.0.0.1:$PROXY_PORT curl --max-time 10 -k -s" else - CURL="curl -s" + CURL="curl --max-time 10 -s" fi # Create a resource group diff --git a/samples/web-app-managed-identity/python/scripts/call-web-app.sh b/samples/web-app-managed-identity/python/scripts/call-web-app.sh index 5f79052..a82964c 100644 --- a/samples/web-app-managed-identity/python/scripts/call-web-app.sh +++ b/samples/web-app-managed-identity/python/scripts/call-web-app.sh @@ -137,12 +137,12 @@ call_web_app() { fi # Retrieve LocalStack proxy port - proxy_port=$(curl http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') + proxy_port=$(curl --max-time 10 http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') if [ -n "$proxy_port" ]; then # Call the web app via emulator proxy echo "Calling web app [$web_app_name] via emulator..." - curl --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via emulator proxy port [$proxy_port] succeeded." @@ -156,7 +156,7 @@ call_web_app() { if [ -n "$container_ip" ]; then # Call the web app via the container IP address echo "Calling web app [$web_app_name] via container IP address [$container_ip]..." - curl -s "http://$container_ip/" 1> /dev/null + curl --max-time 10 -s "http://$container_ip/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via container IP address [$container_ip] succeeded." @@ -170,7 +170,7 @@ call_web_app() { if [ -n "$host_port" ]; then # Call the web app via the host port echo "Calling web app [$web_app_name] via host port [$host_port]..." - curl -s "http://127.0.0.1:$host_port/" 1> /dev/null + curl --max-time 10 -s "http://127.0.0.1:$host_port/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via host port [$host_port] succeeded." @@ -184,7 +184,7 @@ call_web_app() { if [ -n "$app_host_name" ]; then # Call the web app via the default hostname echo "Calling web app [$web_app_name] via default hostname [$app_host_name]..." - curl -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via default hostname [$app_host_name] succeeded." diff --git a/samples/web-app-managed-identity/python/terraform/README.md b/samples/web-app-managed-identity/python/terraform/README.md index 8444885..afd926a 100644 --- a/samples/web-app-managed-identity/python/terraform/README.md +++ b/samples/web-app-managed-identity/python/terraform/README.md @@ -12,18 +12,24 @@ Before deploying this solution, ensure you have the following tools installed: - [Python 3.11+](https://www.python.org/downloads/): Required for running the Flask web application - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -68,7 +74,7 @@ provider "azurerm" { ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -85,7 +91,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `terraform` folder: @@ -197,4 +203,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Terraform Azure Provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-managed-identity/python/terraform/providers.tf b/samples/web-app-managed-identity/python/terraform/providers.tf index 566cfc6..8d561b6 100644 --- a/samples/web-app-managed-identity/python/terraform/providers.tf +++ b/samples/web-app-managed-identity/python/terraform/providers.tf @@ -4,7 +4,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.14.0" + version = "=4.81.0" } } } diff --git a/samples/web-app-mysql-flexible-server/python/README.md b/samples/web-app-mysql-flexible-server/python/README.md index da7e8e8..275cf79 100644 --- a/samples/web-app-mysql-flexible-server/python/README.md +++ b/samples/web-app-mysql-flexible-server/python/README.md @@ -48,7 +48,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application using one of these methods: @@ -103,3 +103,5 @@ mysql> SELECT id, username, activity, created_at FROM activities; - [Quickstart: Python Flask on Azure](https://learn.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=flask%2Cbrowser) - [PyMySQL documentation](https://pymysql.readthedocs.io/) - [LocalStack for Azure](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-mysql-flexible-server/python/bicep/README.md b/samples/web-app-mysql-flexible-server/python/bicep/README.md index e795015..d20722e 100644 --- a/samples/web-app-mysql-flexible-server/python/bicep/README.md +++ b/samples/web-app-mysql-flexible-server/python/bicep/README.md @@ -7,13 +7,13 @@ This directory contains the Bicep template and a deployment script for provision - [LocalStack for Azure](https://docs.localstack.cloud/azure/) - [Visual Studio Code](https://code.visualstudio.com/) + [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep) - [Docker](https://docs.docker.com/get-docker/) -- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/) +- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Python 3.12+](https://www.python.org/downloads/) - [MySQL client (`mysql`)](https://dev.mysql.com/downloads/) - [`jq`](https://jqlang.org/) ```bash -pip install azlocal +brew install localstack/tap/lstk # or: npm install -g @localstack/lstk ``` ## Architecture Overview @@ -93,3 +93,9 @@ az mysql flexible-server show \ --resource-group local-rg --name local-mysqlflex-test \ --query fullyQualifiedDomainName --output tsv ``` + +## Related Documentation + +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-mysql-flexible-server/python/scripts/README.md b/samples/web-app-mysql-flexible-server/python/scripts/README.md index e1f2f53..2d17e6e 100644 --- a/samples/web-app-mysql-flexible-server/python/scripts/README.md +++ b/samples/web-app-mysql-flexible-server/python/scripts/README.md @@ -1,18 +1,18 @@ # Azure CLI Deployment -This directory contains Bash scripts for deploying and validating the sample using the `azlocal` CLI. For details about the sample application, see [Azure Web App with Azure Database for MySQL flexible server](../README.md). +This directory contains Bash scripts for deploying and validating the sample using the `lstk` CLI. For details about the sample application, see [Azure Web App with Azure Database for MySQL flexible server](../README.md). ## Prerequisites - [LocalStack for Azure](https://docs.localstack.cloud/azure/) - [Docker](https://docs.docker.com/get-docker/) -- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/) +- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Python 3.12+](https://www.python.org/downloads/) - [MySQL client (`mysql`)](https://dev.mysql.com/downloads/) - [`jq`](https://jqlang.org/) ```bash -pip install azlocal +brew install localstack/tap/lstk # or: npm install -g @localstack/lstk ``` ## Architecture Overview @@ -63,3 +63,9 @@ bash validate.sh | `MYSQL_APP_PASSWORD` | `TestP@ssw0rd123` | Password for the application user | The script uses [`call-web-app.sh`](call-web-app.sh) (unchanged from the source sample) to demonstrate four ways of hitting the Web App from outside the emulator. + +## Related Documentation + +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-mysql-flexible-server/python/scripts/call-web-app.sh b/samples/web-app-mysql-flexible-server/python/scripts/call-web-app.sh index 3473567..b521aed 100755 --- a/samples/web-app-mysql-flexible-server/python/scripts/call-web-app.sh +++ b/samples/web-app-mysql-flexible-server/python/scripts/call-web-app.sh @@ -139,12 +139,12 @@ call_web_app() { fi # Retrieve LocalStack proxy port - proxy_port=$(curl http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') + proxy_port=$(curl --max-time 10 http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') if [ -n "$proxy_port" ]; then # Call the web app via emulator proxy echo "Calling web app [$web_app_name] via emulator..." - curl --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via emulator proxy port [$proxy_port] succeeded." @@ -158,7 +158,7 @@ call_web_app() { if [ -n "$container_ip" ]; then # Call the web app via the container IP address echo "Calling web app [$web_app_name] via container IP address [$container_ip]..." - curl -s "http://$container_ip:$web_app_port/" 1> /dev/null + curl --max-time 10 -s "http://$container_ip:$web_app_port/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via container IP address [$container_ip] succeeded." @@ -172,7 +172,7 @@ call_web_app() { if [ -n "$host_port" ]; then # Call the web app via the host port echo "Calling web app [$web_app_name] via host port [$host_port]..." - curl -s "http://127.0.0.1:$host_port/" 1> /dev/null + curl --max-time 10 -s "http://127.0.0.1:$host_port/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via host port [$host_port] succeeded." @@ -186,7 +186,7 @@ call_web_app() { if [ -n "$app_host_name" ]; then # Call the web app via the default hostname echo "Calling web app [$web_app_name] via default hostname [$app_host_name]..." - curl -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via default hostname [$app_host_name] succeeded." diff --git a/samples/web-app-mysql-flexible-server/python/terraform/README.md b/samples/web-app-mysql-flexible-server/python/terraform/README.md index b86afe4..3d38144 100644 --- a/samples/web-app-mysql-flexible-server/python/terraform/README.md +++ b/samples/web-app-mysql-flexible-server/python/terraform/README.md @@ -7,13 +7,13 @@ This directory contains Terraform modules and a deployment script for provisioni - [LocalStack for Azure](https://docs.localstack.cloud/azure/) - [Terraform](https://developer.hashicorp.com/terraform/downloads) (1.5+) - [Docker](https://docs.docker.com/get-docker/) -- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/) +- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Python 3.12+](https://www.python.org/downloads/) - [MySQL client (`mysql`)](https://dev.mysql.com/downloads/) - [`jq`](https://jqlang.org/) ```bash -pip install azlocal +brew install localstack/tap/lstk # or: npm install -g @localstack/lstk ``` ## Architecture Overview @@ -61,3 +61,9 @@ Override any of the variables in [`variables.tf`](variables.tf) by editing [`ter | `mysql_database_name` | `plannerdb` | Application database | For non-dev deployments, set `mysql_admin_password` via env var: `MYSQL_ADMIN_PASSWORD=... bash deploy.sh`. + +## Related Documentation + +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-mysql-flexible-server/python/terraform/providers.tf b/samples/web-app-mysql-flexible-server/python/terraform/providers.tf index 3e04500..fe17628 100644 --- a/samples/web-app-mysql-flexible-server/python/terraform/providers.tf +++ b/samples/web-app-mysql-flexible-server/python/terraform/providers.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.60.0" + version = "=4.81.0" } } } diff --git a/samples/web-app-postgresql-flexible-server/python/README.md b/samples/web-app-postgresql-flexible-server/python/README.md index eb33bb7..f811fb2 100644 --- a/samples/web-app-postgresql-flexible-server/python/README.md +++ b/samples/web-app-postgresql-flexible-server/python/README.md @@ -18,7 +18,7 @@ The web app enables users to plan and manage vacation activities; all data is pe 6. [Azure Network Security Group](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): One NSG per subnet. 7. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview): Centralizes diagnostic logs and metrics. 8. [Azure Database for PostgreSQL flexible server](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/overview): Public-access server hosting the `PlannerDB` database. Burstable `Standard_B1ms`, version 16, 32 GiB storage, 7-day backup retention, HA disabled. A permissive firewall rule (`0.0.0.0–255.255.255.255`) is created so the deploy machine can run the post-create psql bootstrap; the Web App itself reaches the server through the Private Endpoint. -9. [PostgreSQL database](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-server-and-database) `PlannerDB`: Created at provisioning time; the post-deploy psql step creates the `activities` table and seeds three demo rows. +9. [PostgreSQL database](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-servers) `PlannerDB`: Created at provisioning time; the post-deploy psql step creates the `activities` table and seeds three demo rows. 10. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans): The underlying compute tier that hosts the web application. 11. [Azure Web App](https://learn.microsoft.com/en-us/azure/app-service/overview): Runs the Python Flask *Vacation Planner* app with regional VNet integration into *app-subnet*. The Web App connects to PostgreSQL using a dedicated application role (`testuser`) — the server-admin login is never used at runtime. 12. [App Service Source Control](https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/create-or-update-source-control?view=rest-appservice-2024-11-01): *(Optional)* Configures continuous deployment from a public GitHub repository. @@ -48,7 +48,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application using one of these methods: @@ -103,3 +103,5 @@ PlannerDB=> SELECT id, username, activity, created_at FROM activities; - [Quickstart: Python Flask on Azure](https://learn.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=flask%2Cbrowser) - [psycopg2 documentation](https://www.psycopg.org/docs/) - [LocalStack for Azure](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-postgresql-flexible-server/python/bicep/README.md b/samples/web-app-postgresql-flexible-server/python/bicep/README.md index da03b68..5eb37f7 100644 --- a/samples/web-app-postgresql-flexible-server/python/bicep/README.md +++ b/samples/web-app-postgresql-flexible-server/python/bicep/README.md @@ -7,13 +7,13 @@ This directory contains the Bicep template and a deployment script for provision - [LocalStack for Azure](https://docs.localstack.cloud/azure/) - [Visual Studio Code](https://code.visualstudio.com/) + [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep) - [Docker](https://docs.docker.com/get-docker/) -- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/) +- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Python 3.12+](https://www.python.org/downloads/) - [PostgreSQL client (`psql`)](https://www.postgresql.org/download/) - [`jq`](https://jqlang.org/) ```bash -pip install azlocal +brew install localstack/tap/lstk # or: npm install -g @localstack/lstk ``` ## Architecture Overview @@ -29,7 +29,7 @@ The [`deploy.sh`](deploy.sh) script creates the resource group while the Bicep m 5. [Network Security Groups](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): one per subnet. 6. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview). 7. [Azure Database for PostgreSQL flexible server](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/overview): public-access mode, Burstable `Standard_B1ms`, version 16, 32 GiB, HA disabled. A permissive firewall rule (`0.0.0.0–255.255.255.255`) lets the deploy machine reach the server for the post-create psql bootstrap. -8. [PostgreSQL database](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-server-and-database) `sampledb` (UTF8 / `en_US.utf8`). +8. [PostgreSQL database](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-servers) `sampledb` (UTF8 / `en_US.utf8`). 9. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans). 10. [Azure Web App](https://learn.microsoft.com/en-us/azure/app-service/overview) with regional VNet integration into *app-subnet*. The Bicep template sets `PG_HOST`, `PG_PORT`, and `PG_DATABASE` on the Web App but **does not** set `PG_USER` or `PG_PASSWORD` — those are written by `deploy.sh` after psql creates the application role. @@ -93,3 +93,9 @@ az postgres flexible-server show \ --resource-group local-rg --name local-pgflex-test \ --query fullyQualifiedDomainName --output tsv ``` + +## Related Documentation + +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-postgresql-flexible-server/python/scripts/README.md b/samples/web-app-postgresql-flexible-server/python/scripts/README.md index 90e1d0a..711a459 100644 --- a/samples/web-app-postgresql-flexible-server/python/scripts/README.md +++ b/samples/web-app-postgresql-flexible-server/python/scripts/README.md @@ -1,18 +1,18 @@ # Azure CLI Deployment -This directory contains Bash scripts for deploying and validating the sample using the `azlocal` CLI. For details about the sample application, see [Azure Web App with Azure Database for PostgreSQL flexible server](../README.md). +This directory contains Bash scripts for deploying and validating the sample using the `lstk` CLI. For details about the sample application, see [Azure Web App with Azure Database for PostgreSQL flexible server](../README.md). ## Prerequisites - [LocalStack for Azure](https://docs.localstack.cloud/azure/) - [Docker](https://docs.docker.com/get-docker/) -- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/) +- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Python 3.12+](https://www.python.org/downloads/) - [PostgreSQL client (`psql`)](https://www.postgresql.org/download/) - [`jq`](https://jqlang.org/) ```bash -pip install azlocal +brew install localstack/tap/lstk # or: npm install -g @localstack/lstk ``` ## Architecture Overview @@ -27,7 +27,7 @@ pip install azlocal - *app-subnet*: delegated to `Microsoft.Web/serverFarms` (with NAT gateway). - *pe-subnet*: hosts the Private Endpoint (no delegation; `disable-private-endpoint-network-policies=true`). 6. [Azure Database for PostgreSQL flexible server](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/overview): public-access mode, `Burstable / Standard_B1ms`, version 16, 32 GiB, HA disabled. With a permissive `AllowAllIPs` firewall rule. -7. The `PlannerDB` [database](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-server-and-database). +7. The `PlannerDB` [database](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-servers). 8. [Azure Private DNS Zone](https://learn.microsoft.com/azure/dns/private-dns-privatednszone) `privatelink.postgres.database.azure.com`, linked to the VNet. 9. [Azure Private Endpoint](https://learn.microsoft.com/azure/private-link/private-endpoint-overview) targeting the PG server with group `postgresqlServer`, plus the DNS-zone group that auto-registers the A record. 10. A separate application role (`testuser`) created via `psql`, with the minimum schema privileges on `PlannerDB`. @@ -64,3 +64,9 @@ bash validate.sh | `DEPLOY_APP` | `1` | Set to `0` to skip the zip deployment step | The script uses [`call-web-app.sh`](call-web-app.sh) (unchanged from the source sample) to demonstrate four ways of hitting the Web App from outside the emulator. + +## Related Documentation + +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-postgresql-flexible-server/python/scripts/call-web-app.sh b/samples/web-app-postgresql-flexible-server/python/scripts/call-web-app.sh index 3473567..b521aed 100755 --- a/samples/web-app-postgresql-flexible-server/python/scripts/call-web-app.sh +++ b/samples/web-app-postgresql-flexible-server/python/scripts/call-web-app.sh @@ -139,12 +139,12 @@ call_web_app() { fi # Retrieve LocalStack proxy port - proxy_port=$(curl http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') + proxy_port=$(curl --max-time 10 http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') if [ -n "$proxy_port" ]; then # Call the web app via emulator proxy echo "Calling web app [$web_app_name] via emulator..." - curl --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via emulator proxy port [$proxy_port] succeeded." @@ -158,7 +158,7 @@ call_web_app() { if [ -n "$container_ip" ]; then # Call the web app via the container IP address echo "Calling web app [$web_app_name] via container IP address [$container_ip]..." - curl -s "http://$container_ip:$web_app_port/" 1> /dev/null + curl --max-time 10 -s "http://$container_ip:$web_app_port/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via container IP address [$container_ip] succeeded." @@ -172,7 +172,7 @@ call_web_app() { if [ -n "$host_port" ]; then # Call the web app via the host port echo "Calling web app [$web_app_name] via host port [$host_port]..." - curl -s "http://127.0.0.1:$host_port/" 1> /dev/null + curl --max-time 10 -s "http://127.0.0.1:$host_port/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via host port [$host_port] succeeded." @@ -186,7 +186,7 @@ call_web_app() { if [ -n "$app_host_name" ]; then # Call the web app via the default hostname echo "Calling web app [$web_app_name] via default hostname [$app_host_name]..." - curl -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via default hostname [$app_host_name] succeeded." diff --git a/samples/web-app-postgresql-flexible-server/python/terraform/README.md b/samples/web-app-postgresql-flexible-server/python/terraform/README.md index c8c5fc9..42aba0a 100644 --- a/samples/web-app-postgresql-flexible-server/python/terraform/README.md +++ b/samples/web-app-postgresql-flexible-server/python/terraform/README.md @@ -7,13 +7,13 @@ This directory contains Terraform modules and a deployment script for provisioni - [LocalStack for Azure](https://docs.localstack.cloud/azure/) - [Terraform](https://developer.hashicorp.com/terraform/downloads) (1.5+) - [Docker](https://docs.docker.com/get-docker/) -- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/) +- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) + [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Python 3.12+](https://www.python.org/downloads/) - [PostgreSQL client (`psql`)](https://www.postgresql.org/download/) - [`jq`](https://jqlang.org/) ```bash -pip install azlocal +brew install localstack/tap/lstk # or: npm install -g @localstack/lstk ``` ## Architecture Overview @@ -30,7 +30,7 @@ The Terraform configuration provisions: 6. [Network Security Groups](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): one per subnet. 7. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview). 8. [Azure Database for PostgreSQL flexible server](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/overview): public-access mode, Burstable `Standard_B1ms`, version 16, 32 GiB, HA disabled. A permissive firewall rule (`AllowAllIPs`, `0.0.0.0–255.255.255.255`) lets the deploy machine reach the server for the post-apply psql bootstrap. -9. [PostgreSQL database](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-server-and-database) `PlannerDB`. +9. [PostgreSQL database](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-servers) `PlannerDB`. 10. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans). 11. [Azure Web App](https://learn.microsoft.com/en-us/azure/app-service/overview) with regional VNet integration. `PG_HOST` / `PG_PORT` / `PG_DATABASE` are written by Terraform; `PG_USER` and `PG_PASSWORD` are written by `deploy.sh` after psql creates the application role. @@ -61,3 +61,9 @@ Override any of the variables in [`variables.tf`](variables.tf) by editing [`ter | `pg_database_name` | `PlannerDB` | Application database | For non-dev deployments, set `pg_admin_password` via env var: `PG_ADMIN_PASSWORD=... bash deploy.sh`. + +## Related Documentation + +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-postgresql-flexible-server/python/terraform/providers.tf b/samples/web-app-postgresql-flexible-server/python/terraform/providers.tf index 3e04500..fe17628 100644 --- a/samples/web-app-postgresql-flexible-server/python/terraform/providers.tf +++ b/samples/web-app-postgresql-flexible-server/python/terraform/providers.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "=4.60.0" + version = "=4.81.0" } } } diff --git a/samples/web-app-sql-database/python/README.md b/samples/web-app-sql-database/python/README.md index 4fb8cdf..66c1eac 100644 --- a/samples/web-app-sql-database/python/README.md +++ b/samples/web-app-sql-database/python/README.md @@ -52,7 +52,7 @@ Certificates: A self-signed certificate is created in Key Vault during deploymen ## Deployment -Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: +Set up the Azure emulator using the LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and set it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the image, execute: ```bash docker pull localstack/localstack-azure @@ -69,7 +69,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Deploy the application to LocalStack for Azure using one of these methods: @@ -131,4 +131,6 @@ e844433e-f36b-1410-88e7-0034efb7413b paolo Go to Mexi - [Quickstart: Python Flask on Azure](https://learn.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=flask%2Cbrowser) - [pyodbc](https://github.com/mkleehammer/pyodbc) - [Azure Identity Client Library for Python](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python) -- [LocalStack for Azure](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-sql-database/python/bicep/README.md b/samples/web-app-sql-database/python/bicep/README.md index 9553822..90a73e4 100644 --- a/samples/web-app-sql-database/python/bicep/README.md +++ b/samples/web-app-sql-database/python/bicep/README.md @@ -1,6 +1,6 @@ # Bicep Deployment -This directory contains the Bicep template and a deployment script for provisioning Azure services in LocalStack for Azure. Refer to the [Azure Web App with Azure SQL Database](../README.md) guide for details about the sample application. +This directory contains the Bicep template and a deployment script for provisioning Azure services in LocalStack for Azure. Refer to the [Azure Web App with Azure SQL Database and Azure Key Vault](../README.md) guide for details about the sample application. ## Prerequisites @@ -11,19 +11,25 @@ Before deploying this solution, ensure you have the following tools installed: - [Bicep extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep): VS Code extension for Bicep language support and IntelliSense - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.12 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -36,11 +42,11 @@ The [deploy.sh](deploy.sh) script creates the [Azure Resource Group](https://lea 5. [App Service Source Control](https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/create-or-update-source-control?view=rest-appservice-2024-11-01): (Optional) Configures automatic deployment from a public GitHub repository. 6. [Azure Key Vault](https://learn.microsoft.com/en-us/azure/key-vault/general/overview): Stores the SQL connection string in a secret. -The web app allows users to plan and manage vacation activities, storing all activity data in the `Activities` table in the `PlannerDB` database. For more information, see [Azure Web App with Azure SQL Database](../README.md). +The web app allows users to plan and manage vacation activities, storing all activity data in the `Activities` table in the `PlannerDB` database. For more information, see [Azure Web App with Azure SQL Database and Azure Key Vault](../README.md). ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -57,7 +63,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `bicep` folder: @@ -134,4 +140,6 @@ This will remove all Azure resources created by the CLI deployment script. - [Azure Bicep Documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/) - [Bicep Language Reference](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-sql-database/python/scripts/README.md b/samples/web-app-sql-database/python/scripts/README.md index 8f3c6cf..3543fa2 100644 --- a/samples/web-app-sql-database/python/scripts/README.md +++ b/samples/web-app-sql-database/python/scripts/README.md @@ -1,6 +1,6 @@ # Azure CLI Deployment -This directory includes Bash scripts designed for deploying and testing the sample Web App utilizing the `azlocal` CLI. For further details about the sample application, refer to the [Azure Web App with Azure SQL Database](../README.md). +This directory includes Bash scripts designed for deploying and testing the sample Web App utilizing the `lstk` CLI. For further details about the sample application, refer to the [Azure Web App with Azure SQL Database and Azure Key Vault](../README.md). ## Prerequisites @@ -10,19 +10,25 @@ Before deploying this solution, ensure you have the following tools installed: - [Visual Studio Code](https://code.visualstudio.com/): Code editor installed on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms) - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [Azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [Python](https://www.python.org/downloads/): Python runtime (version 3.12 or above) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -36,11 +42,11 @@ The [deploy.sh](deploy.sh) Bash script creates the following Azure resources usi 6. [App Service Source Control](https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/create-or-update-source-control?view=rest-appservice-2024-11-01): (Optional) Configures automatic deployment from a public GitHub repository. 7. [Azure Key Vault](https://learn.microsoft.com/en-us/azure/key-vault/general/overview): Stores the SQL connection string in a secret. -The system implements a Vacation Planner web application that stores and retrieves activity data from Azure SQL Database. For more information, see [Azure Web App with Azure SQL Database](../README.md). +The system implements a Vacation Planner web application that stores and retrieves activity data from Azure SQL Database. For more information, see [Azure Web App with Azure SQL Database and Azure Key Vault](../README.md). ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -57,7 +63,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `scripts` folder: @@ -133,4 +139,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Azure CLI Documentation](https://docs.microsoft.com/en-us/cli/azure/) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-sql-database/python/scripts/get-web-app-url.sh b/samples/web-app-sql-database/python/scripts/get-web-app-url.sh index 315ef7e..14a0f12 100755 --- a/samples/web-app-sql-database/python/scripts/get-web-app-url.sh +++ b/samples/web-app-sql-database/python/scripts/get-web-app-url.sh @@ -137,12 +137,12 @@ call_web_app() { fi # Retrieve LocalStack proxy port - proxy_port=$(curl http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') + proxy_port=$(curl --max-time 10 http://localhost:4566/_localstack/proxy -s | jq '.proxy_port') if [ -n "$proxy_port" ]; then # Call the web app via emulator proxy echo "Calling web app [$web_app_name] via emulator..." - curl --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 --proxy "http://localhost:$proxy_port/" -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via emulator proxy port [$proxy_port] succeeded." @@ -156,7 +156,7 @@ call_web_app() { if [ -n "$container_ip" ]; then # Call the web app via the container IP address echo "Calling web app [$web_app_name] via container IP address [$container_ip]..." - curl -s "http://$container_ip/" 1> /dev/null + curl --max-time 10 -s "http://$container_ip/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via container IP address [$container_ip] succeeded." @@ -170,7 +170,7 @@ call_web_app() { if [ -n "$host_port" ]; then # Call the web app via the host port echo "Calling web app [$web_app_name] via host port [$host_port]..." - curl -s "http://127.0.0.1:$host_port/" 1> /dev/null + curl --max-time 10 -s "http://127.0.0.1:$host_port/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via host port [$host_port] succeeded." @@ -184,7 +184,7 @@ call_web_app() { if [ -n "$app_host_name" ]; then # Call the web app via the default hostname echo "Calling web app [$web_app_name] via default hostname [$app_host_name]..." - curl -s "http://$app_host_name/" 1> /dev/null + curl --max-time 10 -s "http://$app_host_name/" 1> /dev/null if [ $? == 0 ]; then echo "Web app call via default hostname [$app_host_name] succeeded." @@ -196,7 +196,7 @@ call_web_app() { fi echo "Validating certificate from Key Vault..." - KV_RESPONSE=$(curl -sk "https://$container_ip:8443/api/certificate") + KV_RESPONSE=$(curl --max-time 10 -sk "https://$container_ip:8443/api/certificate") KV_THUMBPRINT=$(echo "$KV_RESPONSE" | jq -r '.thumbprint') KV_NAME=$(echo "$KV_RESPONSE" | jq -r '.name') KV_SUBJECT=$(echo "$KV_RESPONSE" | jq -r '.subject') diff --git a/samples/web-app-sql-database/python/terraform/README.md b/samples/web-app-sql-database/python/terraform/README.md index 4f0f293..037c9fd 100644 --- a/samples/web-app-sql-database/python/terraform/README.md +++ b/samples/web-app-sql-database/python/terraform/README.md @@ -1,6 +1,6 @@ # Terraform Deployment -This directory contains Terraform modules and a deployment script for provisioning Azure services in LocalStack for Azure. Refer to the [Azure Web App with Azure SQL Database](../README.md) guide for details about the sample application. +This directory contains Terraform modules and a deployment script for provisioning Azure services in LocalStack for Azure. Refer to the [Azure Web App with Azure SQL Database and Azure Key Vault](../README.md) guide for details about the sample application. ## Prerequisites @@ -12,18 +12,24 @@ Before deploying this solution, ensure you have the following tools installed: - [Python 3.11+](https://www.python.org/downloads/): Required for running the Flask web application - [Docker](https://docs.docker.com/get-docker/): Container runtime required for LocalStack - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli): Azure command-line interface -- [azlocal CLI](https://azure.localstack.cloud/user-guides/sdks/az/): LocalStack Azure CLI wrapper +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/): LocalStack command-line interface (proxies the Azure CLI via `lstk az`) - [jq](https://jqlang.org/): JSON processor for scripting and parsing command outputs -### Installing azlocal CLI +### Installing lstk CLI -The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using: +Deploying to LocalStack requires the `lstk` CLI, which routes Azure CLI commands to the emulator (run `lstk az start-interception` before deploying). Install it using Homebrew: ```bash -pip install azlocal +brew install localstack/tap/lstk ``` -For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/). +or npm: + +```bash +npm install -g @localstack/lstk +``` + +Alternatively, download a pre-built binary from the [lstk releases page](https://github.com/localstack/lstk/releases). For more information, see the [lstk CLI documentation](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the [lstk GitHub repository](https://github.com/localstack/lstk). ## Architecture Overview @@ -37,7 +43,7 @@ The [main.tf](main.tf) Terraform module creates the following Azure resources: 6. [Azure Key Vault](https://learn.microsoft.com/en-us/azure/key-vault/general/overview): Stores the SQL connection string as a secret and a self-signed certificate for HTTPS. 7. [App Service Source Control](https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/create-or-update-source-control?view=rest-appservice-2024-11-01): (Optional) Configures automatic deployment from a public GitHub repository. -The system implements a Vacation Planner web application that stores and retrieves activity data from Azure SQL Database. For more information, see [Azure Web App with Azure SQL Database](../README.md). +The system implements a Vacation Planner web application that stores and retrieves activity data from Azure SQL Database. For more information, see [Azure Web App with Azure SQL Database and Azure Key Vault](../README.md). ## Configuration @@ -64,7 +70,7 @@ provider "azurerm" { ## Deployment -You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/?__hstc=108988063.8aad2b1a7229945859f4d9b9bb71e05d.1743148429561.1758793541854.1758810151462.32&__hssc=108988063.3.1758810151462&__hsfp=3945774529) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: +You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator. Refer to the [Auth Token guide](https://docs.localstack.cloud/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable. The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure). To pull the Azure Docker image, execute the following command: ```bash docker pull localstack/localstack-azure @@ -81,7 +87,7 @@ IMAGE_NAME=localstack/localstack-azure localstack start -d localstack wait -t 60 # Route all Azure CLI calls to the LocalStack Azure emulator -azlocal start-interception +lstk az start-interception ``` Navigate to the `terraform` folder: @@ -157,4 +163,6 @@ This will remove all Azure resources created by the CLI deployment script. ## Related Documentation - [Terraform Azure Provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest) -- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) \ No newline at end of file +- [LocalStack for Azure Documentation](https://docs.localstack.cloud/azure/) +- [lstk CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) +- [lstk GitHub repository](https://github.com/localstack/lstk) diff --git a/samples/web-app-sql-database/python/terraform/providers.tf b/samples/web-app-sql-database/python/terraform/providers.tf index 55bebe0..e789fce 100644 --- a/samples/web-app-sql-database/python/terraform/providers.tf +++ b/samples/web-app-sql-database/python/terraform/providers.tf @@ -3,8 +3,12 @@ terraform { required_providers { azurerm = { - source = "hashicorp/azurerm" - version = "=4.25.0" + source = "hashicorp/azurerm" + # Pinned below 4.81.0: azurerm >= ~4.61 strictly parses the `sid` (secret id) + # returned for Key Vault certificates, and the LocalStack Azure emulator currently + # returns the certificate id in that field. Bump back to =4.81.0 once the emulator + # returns a proper `.../secrets/...` sid for certificates. + version = "=4.60.0" } } } @@ -19,7 +23,7 @@ provider "azurerm" { # Set the hostname of the Azure Metadata Service (for example management.azure.com) # used to obtain the Cloud Environment when using LocalStack's Azure emulator. # This allows the provider to correctly identify the environment and avoid making calls to the real Azure endpoints. - metadata_host="localhost.localstack.cloud:4566" + metadata_host = "localhost.localstack.cloud:4566" # Set the subscription ID to a dummy value when using LocalStack's Azure emulator. subscription_id = "00000000-0000-0000-0000-000000000000"