Skip to content
Merged
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
6 changes: 5 additions & 1 deletion .github/workflows/run-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,13 @@ jobs:
# jq: for parsing JSON responses from Azure CLI.
# zip: for packaging function/web apps.
# unixodbc-dev & libsnappy-dev: required for Python database drivers (pyodbc, pymongo).
# default-mysql-client: provides the `mysql` CLI used by the MySQL flexible-server sample
# to create the application user and seed the database schema in the local emulator.
# postgresql-client: provides the `psql` CLI used by the PostgreSQL flexible-server sample
# to create the application role and seed the database schema in the local emulator.
run: |
sudo apt-get update
sudo apt-get install -y jq zip unixodbc-dev libsnappy-dev
sudo apt-get install -y jq zip unixodbc-dev libsnappy-dev default-mysql-client postgresql-client
find . -name "*.sh" -exec chmod +x {} +

- name: Install Terraform
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ This repository contains comprehensive sample projects demonstrating how to deve
| [Web App and Managed Identities](./samples/web-app-managed-identity/python/README.md) | Azure Web App using Managed Identities |
| [Web App and SQL Database ](./samples/web-app-sql-database/python/README.md) | Azure Web App using SQL Database |
| [Web App and PostgreSQL Database ](./samples/web-app-postgresql-flexible-server/python/README.md) | Azure Web App using PostgreSQL Database |
| [Web App and MySQL Database ](./samples/web-app-mysql-flexible-server/python/README.md) | Azure Web App using MySQL Database |
| [Web App with Custom Docker Image](./samples/web-app-custom-image/python/README.md) | Azure Web App running a custom Docker image |
| [ACI and Blob Storage](./samples/aci-blob-storage/python/README.md) | Azure Container Instances with ACR, Key Vault, and Blob Storage |
| [Azure Service Bus with Spring Boot](./samples/servicebus/java/README.md) | Azure Service Bus used by a Spring Boot application |
Expand Down
3 changes: 3 additions & 0 deletions run-samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SAMPLES=(
"samples/web-app-cosmosdb-mongodb-api/python|bash scripts/deploy.sh|bash scripts/validate.sh && bash scripts/call-web-app.sh"
"samples/web-app-managed-identity/python|bash scripts/user-assigned.sh|bash scripts/validate.sh && bash scripts/call-web-app.sh"
"samples/web-app-sql-database/python|bash scripts/deploy.sh|bash scripts/validate.sh && bash scripts/get-web-app-url.sh"
"samples/web-app-mysql-flexible-server/python|bash scripts/deploy.sh|bash scripts/validate.sh && bash scripts/call-web-app.sh"
"samples/web-app-custom-image/python|bash scripts/deploy.sh|bash scripts/validate.sh && bash scripts/call-web-app.sh"
"samples/aci-blob-storage/python|bash scripts/deploy.sh|bash scripts/validate.sh"
)
Expand All @@ -50,6 +51,7 @@ TERRAFORM_SAMPLES=(
"samples/web-app-cosmosdb-mongodb-api/python/terraform|bash deploy.sh"
"samples/web-app-managed-identity/python/terraform|bash deploy.sh"
"samples/web-app-sql-database/python/terraform|bash deploy.sh"
"samples/web-app-mysql-flexible-server/python/terraform|bash deploy.sh"
"samples/aci-blob-storage/python/terraform|bash deploy.sh"
)

Expand All @@ -62,6 +64,7 @@ BICEP_SAMPLES=(
"samples/function-app-storage-http/dotnet/bicep|bash deploy.sh"
"samples/web-app-cosmosdb-mongodb-api/python/bicep|bash deploy.sh"
"samples/web-app-managed-identity/python/bicep|bash deploy.sh"
"samples/web-app-mysql-flexible-server/python/bicep|bash deploy.sh"
"samples/aci-blob-storage/python/bicep|bash deploy.sh"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ NAME=$(az network private-endpoint dns-zone-group show \
--name "$PRIVATE_DNS_ZONE_GROUP_NAME" \
--query name \
--output tsv \
--only-show-errors)
--only-show-errors 2>/dev/null)

if [[ -z $NAME ]]; then
echo "No private DNS zone group [$PRIVATE_DNS_ZONE_GROUP_NAME] for the [$PRIVATE_ENDPOINT_NAME] private endpoint actually exists"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ echo -e "\n[$WEB_APP_NAME] web app:\n"
az webapp show \
--name "$WEB_APP_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,State:state,Location:location,DefaultHostName:defaultHostName}' \
--output table \
--only-show-errors

Expand Down
55 changes: 40 additions & 15 deletions samples/web-app-cosmosdb-nosql-api/python/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,52 @@ After deployment, you can use the `validate.sh` script to verify that all resour
#!/bin/bash

# Variables
PREFIX='local'
SUFFIX='test'
RESOURCE_GROUP_NAME="${PREFIX}-rg"
WEB_APP_NAME="${PREFIX}-webapp-nosql-${SUFFIX}"
APP_SERVICE_PLAN_NAME="${WEB_APP_NAME}"
COSMOSDB_ACCOUNT_NAME="${WEB_APP_NAME}"

# Check resource group
echo -e "[$RESOURCE_GROUP_NAME] resource group:\n"
az group show \
--name local-rg \
--output table

# List resources
az resource list \
--resource-group local-rg \
--output table
--name "$RESOURCE_GROUP_NAME" \
--output table \
--only-show-errors

# Check App Service Plan
echo -e "\n[$APP_SERVICE_PLAN_NAME] app service plan:\n"
az appservice plan show \
--resource-group "$RESOURCE_GROUP_NAME" \
--name "$APP_SERVICE_PLAN_NAME" \
--output table \
--only-show-errors

# Check Azure Web App
echo -e "\n[$WEB_APP_NAME] web app:\n"
az webapp show \
--name local-webapp-nosql-test \
--resource-group local-rg \
--output table

# Check Azure CosmosDB account
--name "$WEB_APP_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,State:state,Location:location,DefaultHostName:defaultHostName}' \
--output table \
--only-show-errors

# Check Azure Cosmos DB account
echo -e "\n[$COSMOSDB_ACCOUNT_NAME] cosmos db account:\n"
az cosmosdb show \
--name local-webapp-nosql-test \
--resource-group local-rg \
--output table
--name "$COSMOSDB_ACCOUNT_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,Location:location,ResourceGroup:resourceGroup,DocumentEndpoint:documentEndpoint,Kind:kind}' \
--output table \
--only-show-errors

# List resources
echo -e "\n[$RESOURCE_GROUP_NAME] all resources:\n"
az resource list \
--resource-group "$RESOURCE_GROUP_NAME" \
--output table \
--only-show-errors
```

## Cleanup
Expand Down
65 changes: 38 additions & 27 deletions samples/web-app-cosmosdb-nosql-api/python/scripts/validate.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,49 @@
#!/bin/bash

# Variables
PREFIX='local'
SUFFIX='test'
RESOURCE_GROUP_NAME="${PREFIX}-rg"
WEB_APP_NAME="${PREFIX}-webapp-nosql-${SUFFIX}"
APP_SERVICE_PLAN_NAME="${WEB_APP_NAME}"
COSMOSDB_ACCOUNT_NAME="${WEB_APP_NAME}"

# Check resource group
echo -e "[$RESOURCE_GROUP_NAME] resource group:\n"
az group show \
--name local-rg \
--output table
--name "$RESOURCE_GROUP_NAME" \
--output table \
--only-show-errors

# List resources
az resource list \
--resource-group local-rg \
--output table
# Check App Service Plan
echo -e "\n[$APP_SERVICE_PLAN_NAME] app service plan:\n"
az appservice plan show \
--resource-group "$RESOURCE_GROUP_NAME" \
--name "$APP_SERVICE_PLAN_NAME" \
--output table \
--only-show-errors

# Check Azure Web App
echo -e "\n[$WEB_APP_NAME] web app:\n"
az webapp show \
--name local-webapp-nosql-test \
--resource-group local-rg \
--output table
--name "$WEB_APP_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,State:state,Location:location,DefaultHostName:defaultHostName}' \
--output table \
--only-show-errors

# Check Azure CosmosDB account
# Check Azure Cosmos DB account
echo -e "\n[$COSMOSDB_ACCOUNT_NAME] cosmos db account:\n"
az cosmosdb show \
--name local-webapp-nosql-test \
--resource-group local-rg \
--output table
--name "$COSMOSDB_ACCOUNT_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,Location:location,ResourceGroup:resourceGroup,DocumentEndpoint:documentEndpoint,Kind:kind}' \
--output table \
--only-show-errors

# Check database (not implemented yet)
# az database show \
# --name sampledb \
# --account-name local-webapp-nosqltest \
# --resource-group local-rg \
# --output table

# Check collection (not impleented yet)
# az cosmosdb collection show \
# --name activities \
# --database-name sampledb \
# --account-name local-webapp-nosql-test \
# --resource-group local-rg \
# --output table
# List resources
echo -e "\n[$RESOURCE_GROUP_NAME] all resources:\n"
az resource list \
--resource-group "$RESOURCE_GROUP_NAME" \
--output table \
--only-show-errors
73 changes: 55 additions & 18 deletions samples/web-app-managed-identity/python/bicep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,33 +100,70 @@ After deployment, you can use the `validate.sh` script to verify that all resour
#!/bin/bash

# Variables
PREFIX='local'
SUFFIX='test'
RESOURCE_GROUP_NAME="${PREFIX}-web-app-rg"
STORAGE_ACCOUNT_NAME="${PREFIX}storage${SUFFIX}"
CONTAINER_NAME='activities'
APP_SERVICE_PLAN_NAME="${PREFIX}-app-service-plan-${SUFFIX}"
WEB_APP_NAME="${PREFIX}-webapp-${SUFFIX}"
MANAGED_IDENTITY_NAME="${PREFIX}-identity-${SUFFIX}"

# Check resource group
echo -e "[$RESOURCE_GROUP_NAME] resource group:\n"
az group show \
--name local-rg \
--output table

# List resources
az resource list \
--resource-group local-rg \
--output table
--name "$RESOURCE_GROUP_NAME" \
--output table \
--only-show-errors

# Check App Service Plan
echo -e "\n[$APP_SERVICE_PLAN_NAME] app service plan:\n"
az appservice plan show \
--resource-group "$RESOURCE_GROUP_NAME" \
--name "$APP_SERVICE_PLAN_NAME" \
--output table \
--only-show-errors

# Check Azure Web App
echo -e "\n[$WEB_APP_NAME] web app:\n"
az webapp show \
--name local-webapp-test \
--resource-group local-rg \
--output table

# Check storage account properties
--name "$WEB_APP_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,State:state,Location:location,DefaultHostName:defaultHostName}' \
--output table \
--only-show-errors

# Check user-assigned managed identity
echo -e "\n[$MANAGED_IDENTITY_NAME] managed identity:\n"
az identity show \
--name "$MANAGED_IDENTITY_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,Location:location,ResourceGroup:resourceGroup,ClientId:clientId,PrincipalId:principalId}' \
--output table \
--only-show-errors

# Check storage account
echo -e "\n[$STORAGE_ACCOUNT_NAME] storage account:\n"
az storage account show \
--name localstoragetest \
--resource-group local-rg \
--output table
--name "$STORAGE_ACCOUNT_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,Location:location,ResourceGroup:resourceGroup,Kind:kind,Sku:sku.name}' \
--output table \
--only-show-errors

# List storage containers
echo -e "\n[$STORAGE_ACCOUNT_NAME] storage containers:\n"
az storage container list \
--account-name localstoragetest \
--output table \
--only-show-errors
--account-name "$STORAGE_ACCOUNT_NAME" \
--output table \
--only-show-errors

# List resources
echo -e "\n[$RESOURCE_GROUP_NAME] all resources:\n"
az resource list \
--resource-group "$RESOURCE_GROUP_NAME" \
--output table \
--only-show-errors
```

## Cleanup
Expand Down
73 changes: 55 additions & 18 deletions samples/web-app-managed-identity/python/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,33 +116,70 @@ After deployment, you can use the `validate.sh` script to verify that all resour
#!/bin/bash

# Variables
PREFIX='local'
SUFFIX='test'
RESOURCE_GROUP_NAME="${PREFIX}-web-app-rg"
STORAGE_ACCOUNT_NAME="${PREFIX}storage${SUFFIX}"
CONTAINER_NAME='activities'
APP_SERVICE_PLAN_NAME="${PREFIX}-app-service-plan-${SUFFIX}"
WEB_APP_NAME="${PREFIX}-webapp-${SUFFIX}"
MANAGED_IDENTITY_NAME="${PREFIX}-identity-${SUFFIX}"

# Check resource group
echo -e "[$RESOURCE_GROUP_NAME] resource group:\n"
az group show \
--name local-rg \
--output table

# List resources
az resource list \
--resource-group local-rg \
--output table
--name "$RESOURCE_GROUP_NAME" \
--output table \
--only-show-errors

# Check App Service Plan
echo -e "\n[$APP_SERVICE_PLAN_NAME] app service plan:\n"
az appservice plan show \
--resource-group "$RESOURCE_GROUP_NAME" \
--name "$APP_SERVICE_PLAN_NAME" \
--output table \
--only-show-errors

# Check Azure Web App
echo -e "\n[$WEB_APP_NAME] web app:\n"
az webapp show \
--name local-webapp-test \
--resource-group local-rg \
--output table

# Check storage account properties
--name "$WEB_APP_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,State:state,Location:location,DefaultHostName:defaultHostName}' \
--output table \
--only-show-errors

# Check user-assigned managed identity
echo -e "\n[$MANAGED_IDENTITY_NAME] managed identity:\n"
az identity show \
--name "$MANAGED_IDENTITY_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,Location:location,ResourceGroup:resourceGroup,ClientId:clientId,PrincipalId:principalId}' \
--output table \
--only-show-errors

# Check storage account
echo -e "\n[$STORAGE_ACCOUNT_NAME] storage account:\n"
az storage account show \
--name localstoragetest \
--resource-group local-rg \
--output table
--name "$STORAGE_ACCOUNT_NAME" \
--resource-group "$RESOURCE_GROUP_NAME" \
--query '{Name:name,Location:location,ResourceGroup:resourceGroup,Kind:kind,Sku:sku.name}' \
--output table \
--only-show-errors

# List storage containers
echo -e "\n[$STORAGE_ACCOUNT_NAME] storage containers:\n"
az storage container list \
--account-name localstoragetest \
--output table \
--only-show-errors
--account-name "$STORAGE_ACCOUNT_NAME" \
--output table \
--only-show-errors

# List resources
echo -e "\n[$RESOURCE_GROUP_NAME] all resources:\n"
az resource list \
--resource-group "$RESOURCE_GROUP_NAME" \
--output table \
--only-show-errors
```

## Cleanup
Expand Down
Loading
Loading