Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/run-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
runs-on: github-ubuntu2204-amd64-4
runs-on: ubuntu-22.04

env:
IMAGE_NAME: localstack/localstack-azure-alpha
Expand Down Expand Up @@ -163,6 +163,7 @@ jobs:
# Required for the 'web-app-sql-database' sample which uses 'sqlcmd' to
# initialize and verify the database schema in the local emulator.
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
Expand Down
9 changes: 8 additions & 1 deletion docs/LOCALSTACK.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ You can start the Azure emulator using one of the following methods:
Make sure the `localstack` CLI is installed (`pip install localstack` or `brew install localstack/tap/localstack`).

```bash
# Set the authentication token
export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
IMAGE_NAME=localstack/localstack-azure-alpha localstack start

# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

This:
Expand Down
7 changes: 3 additions & 4 deletions samples/aci-blob-storage/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ The following diagram illustrates the architecture of the solution:
## Quick Start

```bash
# Start LocalStack Azure
# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Login
azlocal login
azlocal start_interception
# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception

# Deploy all services
cd python
Expand Down
18 changes: 16 additions & 2 deletions samples/function-app-front-door/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,26 @@ The following diagrams visualize each scenario provisioned by `deploy_all.sh`. T

## Quick Start

1. **Deploy against real Azure** (eastus by default):
1.

## Quick Start

1. **Start the LocalStack Azure emulator**
```bash
# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

2. **Deploy against real Azure** (eastus by default):
```bash
bash ./scripts/deploy_all.sh --name-prefix mydemo
```

2. **Deploy against LocalStack emulator**:
3. **Deploy against LocalStack emulator**:
```bash
bash ./scripts/deploy_all.sh --name-prefix mydemo --use-localstack
```
Expand Down
11 changes: 9 additions & 2 deletions samples/function-app-managed-identity/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ docker pull localstack/localstack-azure-alpha
Start the LocalStack Azure emulator by running:

```bash
# Set the authentication token
export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
IMAGE_NAME=localstack/localstack-azure-alpha localstack start

# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

Deploy the application to LocalStack for Azure using one of these methods:
Expand All @@ -79,7 +86,7 @@ All deployment methods have been fully tested with both user-assigned and system

## Test

Once the resources and serverless application have been deployed, you can use the `test.sh` script below to copy a sample file to the `input` container and monitor whether the Azure Functions App processes the input blob file and generates a result file in the `output` container.
Once the resources and serverless application have been deployed, you can use the [test.sh](./scripts/test.sh) script below to copy a sample file to the `input` container and monitor whether the Azure Functions App processes the input blob file and generates a result file in the `output` container.

```bash
#!/bin/bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,15 @@ docker pull localstack/localstack-azure-alpha
Start the LocalStack Azure emulator using the localstack CLI, execute the following command:

```bash
# Set the authentication token
export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
IMAGE_NAME=localstack/localstack-azure-alpha localstack start

# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

Navigate to the `bicep` folder:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,15 @@ docker pull localstack/localstack-azure-alpha
Start the LocalStack Azure emulator using the localstack CLI, execute the following command:

```bash
# Set the authentication token
export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
IMAGE_NAME=localstack/localstack-azure-alpha localstack start

# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

Navigate to the `scripts` folder:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,15 @@ docker pull localstack/localstack-azure-alpha
Start the LocalStack Azure emulator using the localstack CLI, execute the following command:

```bash
# Set the authentication token
export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
IMAGE_NAME=localstack/localstack-azure-alpha localstack start

# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

Navigate to the `terraform` folder:
Expand Down
13 changes: 10 additions & 3 deletions samples/function-app-service-bus/dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,16 @@ docker pull localstack/localstack-azure-alpha
Start the LocalStack Azure emulator by running:

```bash
# Set the authentication token
export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
IMAGE_NAME=localstack/localstack-azure-alpha localstack start
```

# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

Deploy the application to LocalStack for Azure using one of these methods:

Expand Down Expand Up @@ -98,7 +105,7 @@ Getting IP address for container [ls-local-func-test-tdkqjh]...
IP address [172.17.0.7] retrieved successfully for container [ls-local-func-test-tdkqjh]
Getting the host port mapped to internal port 80 in container [ls-local-func-test-tdkqjh]...
Mapped host port [42330] retrieved successfully for container [ls-local-func-test-tdkqjh]
Calling HTTP trigger function to retrieve the last [10] greetings via emulator...
Calling HTTP trigger function to retrieve the last [100] greetings via hostname [babo-func-test.azurewebsites.azure.localhost.localstack.cloud:4566]...
{
"requester": {
"sent": [
Expand Down
9 changes: 8 additions & 1 deletion samples/function-app-service-bus/dotnet/bicep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,15 @@ docker pull localstack/localstack-azure-alpha
Start the LocalStack Azure emulator using the localstack CLI, execute the following command:

```bash
# Set the authentication token
export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
IMAGE_NAME=localstack/localstack-azure-alpha localstack start

# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

Navigate to the `bicep` folder:
Expand Down
9 changes: 8 additions & 1 deletion samples/function-app-service-bus/dotnet/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,15 @@ docker pull localstack/localstack-azure-alpha
Start the LocalStack Azure emulator using the localstack CLI, execute the following command:

```bash
# Set the authentication token
export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
IMAGE_NAME=localstack/localstack-azure-alpha localstack start

# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

Navigate to the `scripts` folder:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ call_http_trigger_function() {
# Get the container IP address
echo "Getting IP address for container [$container_name]..."
container_ip=$(get_docker_container_ip_address_by_name "$container_name")
greeting_count=10
greeting_count=100

if [ $? -eq 0 ] && [ -n "$container_ip" ]; then
echo "IP address [$container_ip] retrieved successfully for container [$container_name]"
Expand All @@ -137,15 +137,12 @@ call_http_trigger_function() {
exit 1
fi

# Retrieve LocalStack proxy port
proxy_port=$(curl http://localhost:4566/_localstack/proxy -s | jq '.proxy_port')

if [ -n "$proxy_port" ]; then
# Call the GetGreetings HTTP trigger function to retrieve the last greetings via emulator
echo "Calling HTTP trigger function to retrieve the last [$greeting_count] greetings via emulator..."
curl --proxy "http://localhost:$proxy_port/" -s "http://$function_host_name/api/greetings?count=$greeting_count" | jq
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
else
echo "Failed to retrieve LocalStack proxy port"
echo "Failed to retrieve function hostname"
fi

if [ -n "$container_ip" ]; then
Expand Down
55 changes: 24 additions & 31 deletions samples/function-app-service-bus/dotnet/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,23 @@ PE_NAMES=(
"${PREFIX}-queue-storage-pe-${SUFFIX}"
"${PREFIX}-table-storage-pe-${SUFFIX}"
)
PE_GROUP_IDS=("namespace" "blob" "queue" "table")
PE_CONNECTION_NAMES=("servicebus-connection" "blob-connection" "queue-connection" "table-connection")
PE_DNS_ZONES=("privatelink.servicebus.windows.net" "privatelink.blob.core.windows.net" "privatelink.queue.core.windows.net" "privatelink.table.core.windows.net")
PE_DNS_ZONE_LABELS=("servicebus-zone" "blob-zone" "queue-zone" "table-zone")
PE_GROUP_IDS=(
"namespace"
"blob" "queue"
"table"
)
PE_CONNECTION_NAMES=(
"servicebus-connection"
"blob-connection"
"queue-connection"
"table-connection"
)
PE_DNS_ZONES=(
"privatelink.servicebus.windows.net"
"privatelink.blob.core.windows.net"
"privatelink.queue.core.windows.net"
"privatelink.table.core.windows.net"
)

# Change the current directory to the script's directory
cd "$CURRENT_DIR" || exit
Expand Down Expand Up @@ -640,7 +653,6 @@ for i in "${!PE_NAMES[@]}"; do
PE_RESOURCE_ID="${PE_RESOURCE_IDS[$i]}"
PE_CONNECTION="${PE_CONNECTION_NAMES[$i]}"
PE_DNS_ZONE="${PE_DNS_ZONES[$i]}"
PE_DNS_ZONE_LABEL="${PE_DNS_ZONE_LABELS[$i]}"

# Check if the private endpoint already exists
echo "Checking if private endpoint [$PE_NAME] exists in the [$RESOURCE_GROUP_NAME] resource group..."
Expand Down Expand Up @@ -679,15 +691,15 @@ for i in "${!PE_NAMES[@]}"; do

# Check if the private DNS zone group is already created
echo "Checking if the private DNS zone group [$PRIVATE_DNS_ZONE_GROUP_NAME] for the [$PE_NAME] private endpoint already exists..."
az network private-endpoint dns-zone-group show \
NAME=$(az network private-endpoint dns-zone-group show \
--resource-group "$RESOURCE_GROUP_NAME" \
--endpoint-name "$PE_NAME" \
--name "$PRIVATE_DNS_ZONE_GROUP_NAME" \
--query name \
--output tsv \
--only-show-errors &>/dev/null
--only-show-errors)

if [[ $? != 0 ]]; then
if [[ -z $NAME ]]; then
echo "No private DNS zone group [$PRIVATE_DNS_ZONE_GROUP_NAME] for the [$PE_NAME] private endpoint actually exists"
echo "Creating private DNS zone group [$PRIVATE_DNS_ZONE_GROUP_NAME] for the [$PE_NAME] private endpoint..."

Expand All @@ -697,7 +709,7 @@ for i in "${!PE_NAMES[@]}"; do
--resource-group "$RESOURCE_GROUP_NAME" \
--endpoint-name "$PE_NAME" \
--private-dns-zone "$PE_DNS_ZONE" \
--zone-name "$PE_DNS_ZONE_LABEL" \
--zone-name "$PE_DNS_ZONE" \
--only-show-errors 1>/dev/null

if [[ $? == 0 ]]; then
Expand All @@ -716,26 +728,6 @@ if [ $DEPLOY -eq 0 ]; then
exit 0
fi

# Check if the application insights az extension is already installed
echo "Checking if [application-insights] az extension is already installed..."
az extension show --name application-insights &>/dev/null

if [[ $? == 0 ]]; then
echo "[application-insights] az extension is already installed"
else
echo "[application-insights] az extension is not installed. Installing..."

# Install application-insights az extension
az extension add --name application-insights 1>/dev/null

if [[ $? == 0 ]]; then
echo "[application-insights] az extension successfully installed"
else
echo "Failed to install [application-insights] az extension"
exit
fi
fi

# Check if the application insights component already exists
echo "Checking if [$APPLICATION_INSIGHTS_NAME] Application Insights component exists in the [$RESOURCE_GROUP_NAME] resource group..."
az monitor app-insights component show \
Expand Down Expand Up @@ -1061,7 +1053,7 @@ if ! az appservice plan show \
--name $APP_SERVICE_PLAN_NAME \
--resource-group $RESOURCE_GROUP_NAME \
--location $LOCATION \
--sku B1 \
--sku S1 \
--is-linux \
--tags $TAGS \
--only-show-errors 1>/dev/null; then
Expand Down Expand Up @@ -1162,6 +1154,7 @@ az functionapp config appsettings set \
--name $FUNCTION_APP_NAME \
--resource-group $RESOURCE_GROUP_NAME \
--settings \
APPLICATIONINSIGHTS_AUTHENTICATION_STRING="ClientId=${CLIENT_ID};Authorization=AAD" \
AZURE_CLIENT_ID="$CLIENT_ID" \
SCM_DO_BUILD_DURING_DEPLOYMENT=false \
FUNCTIONS_WORKER_RUNTIME=${RUNTIME,,} \
Expand Down Expand Up @@ -1457,4 +1450,4 @@ fi

# Print the list of resources in the resource group
echo "Listing resources in resource group [$RESOURCE_GROUP_NAME]..."
az resource list --resource-group "$RESOURCE_GROUP_NAME" --output table
az resource list --resource-group "$RESOURCE_GROUP_NAME" --output table
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,15 @@ docker pull localstack/localstack-azure-alpha
Start the LocalStack Azure emulator using the localstack CLI, execute the following command:

```bash
# Set the authentication token
export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
IMAGE_NAME=localstack/localstack-azure-alpha localstack start

# Start the LocalStack Azure emulator
IMAGE_NAME=localstack/localstack-azure-alpha localstack start -d
localstack wait -t 60

# Route all Azure CLI calls to the LocalStack Azure emulator
azlocal start-interception
```

Navigate to the `terraform` folder:
Expand Down
Loading
Loading