### Start Azure Emulator with Docker Compose Command Source: https://azure.localstack.cloud/getting-started Command to initiate the Azure emulator defined in a `docker-compose.yml` file. ```bash docker-compose up ``` -------------------------------- ### Start Azure Emulator with docker CLI Source: https://azure.localstack.cloud/getting-started Launches the Azure emulator using the `docker` CLI. This command maps ports, mounts volumes for persistence, and sets the authentication token. ```bash docker run \ --rm -it \ -p 4566:4566 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v ~/.localstack/volume:/var/lib/localstack \ -e LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?} \ localstack/localstack-azure-alpha ``` -------------------------------- ### Start Azure Emulator with Docker Compose Source: https://azure.localstack.cloud/getting-started/installation Defines and starts the Azure emulator using a Docker Compose configuration file. This is ideal for managing multi-container applications or when you need a reproducible setup. It specifies the image, port mapping, environment variables, and volumes. ```yaml version: "3.8" services: localstack: container_name: "localstack-main" image: localstack/localstack-azure-alpha ports: - "127.0.0.1:4566:4566" environment: - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?} volumes: - "./volume:/var/lib/localstack" ``` -------------------------------- ### Start Azure Emulator with docker CLI Source: https://azure.localstack.cloud/getting-started/installation Launches the Azure emulator using the 'docker run' command. This command maps ports, mounts volumes for persistence, and sets the authentication token. It offers more control over container configuration compared to the CLI method. ```bash docker run \ --rm -it \ -p 4566:4566 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v ~/.localstack/volume:/var/lib/localstack \ -e LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?} localstack/localstack-azure-alpha ``` -------------------------------- ### Start Azure Emulator with localstack CLI Source: https://azure.localstack.cloud/getting-started/installation Starts the Azure emulator using the LocalStack CLI. This method requires setting the LOCALSTACK_AUTH_TOKEN environment variable and specifying the image name. It's a convenient way to launch the emulator for testing. ```bash export LOCALSTACK_AUTH_TOKEN= IMAGE_NAME=localstack/localstack-azure-alpha localstack start ``` -------------------------------- ### List Azure Storage Containers using LocalStack CLI Source: https://azure.localstack.cloud/user-guides/azure/blobs Demonstrates listing available containers within a specified Azure storage account using the `azlocal` tool. ```bash $ azlocal storage container list \ --account-name testaccount \ --auth-mode login ``` -------------------------------- ### Setup azlocal CLI for Azure Emulator Source: https://azure.localstack.cloud/getting-started/quickstart This command configures the Azure CLI to communicate with the LocalStack Azure emulator. It intercepts `az` CLI commands and redirects them to the local emulator instead of the actual Azure cloud. ```bash azlocal start_interception ``` -------------------------------- ### Create Azure Storage Container using LocalStack CLI Source: https://azure.localstack.cloud/user-guides/azure/blobs Illustrates how to create a container within an Azure storage account using the `azlocal` tool. Containers organize blobs. ```bash $ azlocal storage container create \ --name testcontainer \ --account-name testaccount \ --auth-mode login ``` -------------------------------- ### Create Azure Storage Account using Azure CLI Source: https://azure.localstack.cloud/user-guides/azure/blobs Shows how to create an Azure storage account using the Azure CLI. This account will be used to store blobs and other data. ```bash $ az storage account create \ --name testaccount \ --resource-group MyResourceGroup \ --location westeurope \ --sku Standard_LRS ``` -------------------------------- ### Update Azure Docker Container Source: https://azure.localstack.cloud/getting-started/installation Instructions to update the Azure Docker container by pulling the latest image and restarting the container. The 'latest' tag points to the nightly build. ```bash # Pull the latest image docker pull localstack/localstack-azure-alpha:latest # Restart the container (example using docker-compose) docker-compose down docker-compose up -d ``` -------------------------------- ### Create Azure Resource Group using Azure CLI Source: https://azure.localstack.cloud/user-guides/azure/blobs Demonstrates how to create a resource group for Azure resources using the Azure CLI. This is a prerequisite for creating storage accounts. ```bash $ az group create \ --name MyResourceGroup \ --location westeurope ``` -------------------------------- ### Pull LocalStack Azure Docker Image Source: https://azure.localstack.cloud/getting-started/installation This command downloads the latest Azure alpha version of the LocalStack Docker image from Docker Hub. Ensure you have Docker installed and configured. ```bash docker pull localstack/localstack-azure-alpha ``` -------------------------------- ### Show and List Azure Resource Groups using az CLI Source: https://azure.localstack.cloud/getting-started/quickstart These commands allow you to view details of a specific resource group or list all existing resource groups within the Azure emulator. `az group show` displays information for a named group, while `azlocal group list` provides a list of all groups. ```bash az group show --name MyResourceGroup ``` ```bash azlocal group list ``` -------------------------------- ### Download Blob from Azure Storage using LocalStack CLI Source: https://azure.localstack.cloud/user-guides/azure/blobs Illustrates how to download a blob from a specified container in an Azure storage account to a local file using the `azlocal` tool. ```bash $ azlocal storage blob download \ --container-name testcontainer \ --account-name testaccount \ --file check.txt \ --name testblog \ --auth-mode login ``` -------------------------------- ### Create Azure Resource Group using az CLI Source: https://azure.localstack.cloud/getting-started/quickstart This command creates a new resource group in the Azure emulator. It takes the resource group name and location as input. The output shows the details of the created resource group, including its ID, name, and provisioning state. ```bash az group create --name MyResourceGroup --location westeurope ``` -------------------------------- ### Deploy Azure Infrastructure with azdlocal Source: https://azure.localstack.cloud/user-guides/sdks/azd Deploys the defined Azure resources (e.g., resource group) to LocalStack using the `azdlocal` command. This command initiates the provisioning process. ```bash azdlocal up ``` -------------------------------- ### Install Azure SDK for Python packages Source: https://azure.localstack.cloud/user-guides/sdks/python Installs the 'azlocal' package for LocalStack integration and essential Azure SDK packages for Python resource management and identity. ```bash pip install azlocal pip install azure-mgmt-resource azure-identity ``` -------------------------------- ### Azure LocalStack Configuration (azure.yaml) Source: https://azure.localstack.cloud/user-guides/sdks/azd Defines the configuration for an Azure Developer tool project targeting LocalStack. It specifies the project name and schema for validation. ```yaml # yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json name: simple-template ``` -------------------------------- ### Verify Resource Group Creation with azlocal Source: https://azure.localstack.cloud/user-guides/sdks/azd Logs into the LocalStack emulator and lists the available resource groups to verify successful deployment. This uses the `azlocal` tool, which mimics `az` commands for LocalStack. ```bash azlocal login azlocal group list ``` -------------------------------- ### Bicep Template Parameters for Resource Group Source: https://azure.localstack.cloud/user-guides/sdks/azd Specifies the parameters for a Bicep deployment, particularly for the 'name' parameter, which is dynamically set using an environment variable. ```json { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "parameters": { "name": { "value": "${AZURE_ENV_NAME}" } } } ``` -------------------------------- ### Teardown azlocal CLI for Azure Emulator Source: https://azure.localstack.cloud/getting-started/quickstart This command stops the interception of Azure CLI commands by the LocalStack emulator. After running this, all `az` CLI commands will be directed to the actual Azure cloud services again, effectively disabling the local emulator for Azure. ```bash azlocal stop_interception ``` -------------------------------- ### Delete Azure Resource Group using az CLI Source: https://azure.localstack.cloud/getting-started/quickstart This command deletes a specified resource group from the Azure emulator. The `--yes` flag confirms the deletion without requiring additional prompts. This is useful for cleaning up resources after testing. ```bash az group delete --name MyResourceGroup --yes ``` -------------------------------- ### Upload Blob to Azure Storage using LocalStack CLI Source: https://azure.localstack.cloud/user-guides/azure/blobs Shows how to upload a blob (file) to a specified container in an Azure storage account using the `azlocal` tool. Requires raw data and a blob name. ```bash $ azlocal storage blob upload \ --container-name testcontainer \ --account-name testaccount \ --data "Your raw data here" \ --name testblog \ --auth-mode login ``` -------------------------------- ### Install LocalStack Azure Packages with Pip Source: https://azure.localstack.cloud/user-guides/sdks/terraform Installs the necessary Python package for interacting with Azure resources locally using LocalStack. This package provides the 'azlocal' CLI tool. ```bash pip install azlocal ``` -------------------------------- ### View Blob Details using Azure CLI with LocalStack Source: https://azure.localstack.cloud/user-guides/azure/blobs This command utilizes the Azure CLI to display detailed information about a specific blob stored in Azure blob storage when using LocalStack. It requires the account name, container name, and blob name as input. The output includes various properties of the blob. ```bash $ azlocal storage blob show \ --account-name testaccount \ --container testcontainer \ --auth-mode login \ --name testblog__Copy ``` -------------------------------- ### Bicep Template for Resource Group Deployment Source: https://azure.localstack.cloud/user-guides/sdks/azd A Bicep template to create an Azure resource group. It defines parameters for environment name and generates a resource group with a specified name and location, including tags. ```bicep targetScope = 'subscription' @minLength(1) @maxLength(64) @description('Name of the the environment which is used to generate a short unique hash used in all resources.') param name string var tags = { 'azd-env-name': name } resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { name: '${name}-rg' location: 'westeurope' tags: tags } ``` -------------------------------- ### Python Script for Azure Resource Group Management on LocalStack Source: https://azure.localstack.cloud/user-guides/sdks/python A Python script utilizing Azure SDK for Python and LocalStack's 'azlocal' to provision and update Azure resource groups. It requires mock credentials and a subscription ID. The script starts and stops LocalStack request interception. ```python from azlocal.python_local_sdk import PythonLocalSdk from azure.mgmt.resource import ResourceManagementClient from azure.identity import ClientSecretCredential def get_credentials(): return ClientSecretCredential(tenant_id="tenant-id", client_id="client_id", client_secret="client_secret") def create_or_update_resource_group(resource_client, group_name, location, tags=None): # Provision or update the resource group rg_result = resource_client.resource_groups.create_or_update( group_name, {"location": location, "tags": tags if tags else {}}) # Logging the action taken action = "Updated" if tags else "Provisioned" print(f"{action} resource group {rg_result.name} in the {rg_result.location} region with tags {tags}") # Intercept all Azure requests python_local_sdk = PythonLocalSdk() python_local_sdk.start_interception() # Setup credentials and client credential = get_credentials() subscription_id = "sub-id" resource_client = ResourceManagementClient(credential, subscription_id) # Create or update resource groups create_or_update_resource_group(resource_client, "PythonAzureExample-rg", "centralus") create_or_update_resource_group(resource_client, "PythonAzureExample-rg", "centralus", {"environment": "test", "department": "tech"}) # Stop interception of Azure requests python_local_sdk.stop_interception() ``` -------------------------------- ### Initialize Terraform Project with tflocal Source: https://azure.localstack.cloud/user-guides/sdks/terraform Initializes the Terraform project using the 'tflocal' command. This downloads the necessary provider plugins as defined in the Terraform configuration files. ```bash tflocal init ``` -------------------------------- ### List Slot Configuration Names Source: https://azure.localstack.cloud/references/coverage/coverage_microsoft Retrieves a list of configuration names available for a deployment slot. This helps in understanding the configurable aspects of a slot. ```APIDOC ## GET /websites/{name}/slots/{slot}/configNames ### Description Retrieves a list of configuration names available for a deployment slot. ### Method GET ### Endpoint `/websites/{name}/slots/{slot}/configNames` ### Parameters #### Path Parameters - **name** (string) - Required - The name of the website. - **slot** (string) - Required - The name of the deployment slot. ### Response #### Success Response (200) - **properties** (object) - An object containing lists of configuration names. #### Response Example ```json { "properties": { "applicationSettings": ["setting1", "setting2"], "connectionStrings": ["db1", "db2"] } } ``` ``` -------------------------------- ### Run Python Script to Manage Azure Resources Source: https://azure.localstack.cloud/user-guides/sdks/python Executes the Python script 'provision_rg.py' using the Python 3 interpreter to provision and update Azure resource groups via LocalStack. ```bash python3 provision_rg.py ``` -------------------------------- ### List Azure Resource Groups with LocalStack CLI Source: https://azure.localstack.cloud/user-guides/sdks/terraform Lists all available Azure resource groups using the 'azlocal' CLI tool. This command is used to verify the successful creation of resources deployed via Terraform. ```bash azlocal group list ``` -------------------------------- ### List Publishing Profile Xml With Secrets Source: https://azure.localstack.cloud/references/coverage/coverage_microsoft Retrieves the publishing profile XML with secrets for a website or a deployment slot. This profile contains credentials and settings needed for deployment. ```APIDOC ## GET /websites/{name}/publishXml ### Description Retrieves the publishing profile XML with secrets for a website. ### Method GET ### Endpoint `/websites/{name}/publishXml` ### Parameters #### Path Parameters - **name** (string) - Required - The name of the website. ### Response #### Success Response (200) - **value** (string) - The publishing profile XML content. #### Response Example ```xml user password ``` ``` -------------------------------- ### Update Application Settings Source: https://azure.localstack.cloud/references/coverage/coverage_microsoft Updates the application settings for a website or a deployment slot. This allows modification of environment variables and other configuration settings. ```APIDOC ## PUT /websites/{name}/applicationSettings ### Description Updates the application settings for a website. ### Method PUT ### Endpoint `/websites/{name}/applicationSettings` ### Parameters #### Path Parameters - **name** (string) - Required - The name of the website. #### Request Body - **properties** (object) - Required - A JSON object containing the application settings to update. ### Request Example ```json { "properties": { "setting1": "value1", "setting2": "value2" } } ``` ### Response #### Success Response (200) - **properties** (object) - The updated application settings. #### Response Example ```json { "properties": { "setting1": "value1", "setting2": "value2" } } ``` ``` -------------------------------- ### Login to Azure with LocalStack CLI Source: https://azure.localstack.cloud/user-guides/sdks/terraform Logs into the Azure environment using the LocalStack CLI tool. This command authenticates the 'azlocal' tool to interact with the LocalStack emulator. ```bash azlocal login ``` -------------------------------- ### Apply Terraform Configuration with tflocal Source: https://azure.localstack.cloud/user-guides/sdks/terraform Applies the Terraform configuration to create or update infrastructure resources. The 'tflocal apply' command executes the plan generated by Terraform against the LocalStack emulator. ```bash tflocal apply ``` -------------------------------- ### Update Diagnostic Logs Configuration Source: https://azure.localstack.cloud/references/coverage/coverage_microsoft Updates the diagnostic logging configuration for a website or a deployment slot. This allows control over what logs are collected and where they are stored. ```APIDOC ## PUT /websites/{name}/diagnosticLogs ### Description Updates the diagnostic logging configuration for a website. ### Method PUT ### Endpoint `/websites/{name}/diagnosticLogs` ### Parameters #### Path Parameters - **name** (string) - Required - The name of the website. #### Request Body - **properties** (object) - Required - A JSON object containing the diagnostic log settings to update. ### Request Example ```json { "properties": { "logLevel": "Information", "applicationLogs": { "fileSystem": { "level": "Verbose" } } } } ``` ### Response #### Success Response (200) - **properties** (object) - The updated diagnostic log configuration. #### Response Example ```json { "properties": { "logLevel": "Information", "applicationLogs": { "fileSystem": { "level": "Verbose" } } } } ``` ``` -------------------------------- ### Terraform Azure Provider Configuration Source: https://azure.localstack.cloud/user-guides/sdks/terraform Configures the Terraform Azure provider, specifying the source and version of the azurerm provider and setting the subscription ID. This file is essential for Terraform to interact with Azure resources. ```terraform terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "=4.14.0" } } } provider "azurerm" { features {} subscription_id = "00000000-0000-0000-0000-000000000000" } ``` -------------------------------- ### Update Azure Storage Accounts Source: https://azure.localstack.cloud/references/coverage/coverage_microsoft Updates the Azure storage accounts associated with a website or a deployment slot. This is crucial for configuring data storage and access. ```APIDOC ## PUT /websites/{name}/azureStorageAccounts ### Description Updates the Azure storage accounts associated with a website. ### Method PUT ### Endpoint `/websites/{name}/azureStorageAccounts` ### Parameters #### Path Parameters - **name** (string) - Required - The name of the website. #### Request Body - **properties** (object) - Required - A JSON object containing the Azure storage account configurations to update. ### Request Example ```json { "properties": { "accountName": "myStorageAccount", "connectionString": "DefaultEndpointsProtocol=https;AccountName=myStorageAccount;..." } } ``` ### Response #### Success Response (200) - **properties** (object) - The updated Azure storage account configurations. #### Response Example ```json { "properties": { "accountName": "myStorageAccount", "connectionString": "DefaultEndpointsProtocol=https;AccountName=myStorageAccount;..." } } ``` ``` -------------------------------- ### Terraform Azure Resource Group Definition Source: https://azure.localstack.cloud/user-guides/sdks/terraform Defines an Azure resource group using Terraform. This configuration creates a resource group with a unique name and specifies its location. It leverages the 'random_uuid' resource for dynamic naming. ```terraform resource "random_uuid" "uuid" {} resource "azurerm_resource_group" "rg" { name = "rg-hello-tf-${random_uuid.uuid.result}" location = "westeurope" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.