From 0ce0bb1e99ca6c2712bbc5ec810a7fc955b0dab4 Mon Sep 17 00:00:00 2001 From: dbradish-microsoft Date: Wed, 25 Oct 2023 16:16:58 -0400 Subject: [PATCH 1/2] testing onboard with Samples Browser --- Includes/cli-clean-up-resources.md | 9 ++ Includes/cli-launch-cloud-shell-sign-in.md | 27 ++++++ Includes/quickstarts-free-trial-note.md | 8 ++ .../Includes/cli-clean-up-resources.md | 9 ++ .../cli-launch-cloud-shell-sign-in.md | 27 ++++++ .../Includes/quickstarts-free-trial-note.md | 8 ++ app-service/README.md | 91 ++++++++++--------- .../README.md | 50 ++++++++++ .../deploy-custom-domain/README.md | 2 +- 9 files changed, 188 insertions(+), 43 deletions(-) create mode 100644 Includes/cli-clean-up-resources.md create mode 100644 Includes/cli-launch-cloud-shell-sign-in.md create mode 100644 Includes/quickstarts-free-trial-note.md create mode 100644 app-service/Includes/cli-clean-up-resources.md create mode 100644 app-service/Includes/cli-launch-cloud-shell-sign-in.md create mode 100644 app-service/Includes/quickstarts-free-trial-note.md create mode 100644 app-service/backup-one-time-schedule-restore/README.md diff --git a/Includes/cli-clean-up-resources.md b/Includes/cli-clean-up-resources.md new file mode 100644 index 00000000..024c2f9f --- /dev/null +++ b/Includes/cli-clean-up-resources.md @@ -0,0 +1,9 @@ +--- +ms.topic: include +ms.date: 04/29/2022 +author: dbradish-microsoft +ms.author: dbradish +manager: barbkess +--- + +Use the following command to remove the resource group and all resources associated with it using the [az group delete](/cli/azure/group#az-group-delete) command - unless you have an ongoing need for these resources. Some of these resources may take a while to create, as well as to delete. diff --git a/Includes/cli-launch-cloud-shell-sign-in.md b/Includes/cli-launch-cloud-shell-sign-in.md new file mode 100644 index 00000000..1a196a75 --- /dev/null +++ b/Includes/cli-launch-cloud-shell-sign-in.md @@ -0,0 +1,27 @@ +--- +ms.topic: include +ms.date: 01/05/2022 +author: dbradish-microsoft +ms.author: dbradish +manager: barbkess +--- + +### Launch Azure Cloud Shell + +The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account. + +To open the Cloud Shell, just select **Try it** from the upper right corner of a code block. You can also launch Cloud Shell in a separate browser tab by going to [https://shell.azure.com](https://shell.azure.com). + +When Cloud Shell opens, verify that **Bash** is selected for your environment. Subsequent sessions will use Azure CLI in a Bash environment, Select **Copy** to copy the blocks of code, paste it into the Cloud Shell, and press **Enter** to run it. + +### Sign in to Azure + +Cloud Shell is automatically authenticated under the initial account signed-in with. Use the following script to sign in using a different subscription, replacing `` with your Azure Subscription ID. [!INCLUDE [quickstarts-free-trial-note](quickstarts-free-trial-note.md)] + +```azurecli-interactive +subscription="" # add subscription here + +az account set -s $subscription # ...or use 'az login' +``` + +For more information, see [set active subscription](/cli/azure/account#az-account-set) or [log in interactively](/cli/azure/reference-index#az-login) diff --git a/Includes/quickstarts-free-trial-note.md b/Includes/quickstarts-free-trial-note.md new file mode 100644 index 00000000..e98fe8f2 --- /dev/null +++ b/Includes/quickstarts-free-trial-note.md @@ -0,0 +1,8 @@ +--- +author: SyntaxC4 +ms.service: cloud-services +ms.topic: include +ms.date: 01/18/2022 +ms.author: cfowler +--- +If you don't have an [Azure subscription](../articles/guides/developer/azure-developer-guide.md#understanding-accounts-subscriptions-and-billing), create an [Azure free account](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio) before you begin. \ No newline at end of file diff --git a/app-service/Includes/cli-clean-up-resources.md b/app-service/Includes/cli-clean-up-resources.md new file mode 100644 index 00000000..024c2f9f --- /dev/null +++ b/app-service/Includes/cli-clean-up-resources.md @@ -0,0 +1,9 @@ +--- +ms.topic: include +ms.date: 04/29/2022 +author: dbradish-microsoft +ms.author: dbradish +manager: barbkess +--- + +Use the following command to remove the resource group and all resources associated with it using the [az group delete](/cli/azure/group#az-group-delete) command - unless you have an ongoing need for these resources. Some of these resources may take a while to create, as well as to delete. diff --git a/app-service/Includes/cli-launch-cloud-shell-sign-in.md b/app-service/Includes/cli-launch-cloud-shell-sign-in.md new file mode 100644 index 00000000..1a196a75 --- /dev/null +++ b/app-service/Includes/cli-launch-cloud-shell-sign-in.md @@ -0,0 +1,27 @@ +--- +ms.topic: include +ms.date: 01/05/2022 +author: dbradish-microsoft +ms.author: dbradish +manager: barbkess +--- + +### Launch Azure Cloud Shell + +The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account. + +To open the Cloud Shell, just select **Try it** from the upper right corner of a code block. You can also launch Cloud Shell in a separate browser tab by going to [https://shell.azure.com](https://shell.azure.com). + +When Cloud Shell opens, verify that **Bash** is selected for your environment. Subsequent sessions will use Azure CLI in a Bash environment, Select **Copy** to copy the blocks of code, paste it into the Cloud Shell, and press **Enter** to run it. + +### Sign in to Azure + +Cloud Shell is automatically authenticated under the initial account signed-in with. Use the following script to sign in using a different subscription, replacing `` with your Azure Subscription ID. [!INCLUDE [quickstarts-free-trial-note](quickstarts-free-trial-note.md)] + +```azurecli-interactive +subscription="" # add subscription here + +az account set -s $subscription # ...or use 'az login' +``` + +For more information, see [set active subscription](/cli/azure/account#az-account-set) or [log in interactively](/cli/azure/reference-index#az-login) diff --git a/app-service/Includes/quickstarts-free-trial-note.md b/app-service/Includes/quickstarts-free-trial-note.md new file mode 100644 index 00000000..e98fe8f2 --- /dev/null +++ b/app-service/Includes/quickstarts-free-trial-note.md @@ -0,0 +1,8 @@ +--- +author: SyntaxC4 +ms.service: cloud-services +ms.topic: include +ms.date: 01/18/2022 +ms.author: cfowler +--- +If you don't have an [Azure subscription](../articles/guides/developer/azure-developer-guide.md#understanding-accounts-subscriptions-and-billing), create an [Azure free account](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio) before you begin. \ No newline at end of file diff --git a/app-service/README.md b/app-service/README.md index fdf7e0fe..869f0288 100644 --- a/app-service/README.md +++ b/app-service/README.md @@ -1,59 +1,66 @@ -# Azure Container Registry +--- +page_type: sample +languages: +- azurecli +products: +- azure +- azure-cli +- azure-app-service +name: Azure App Service sample scripts +url-fragment: +description: These scripts demonstrate how to work with Azure App Service using the Azure CLI +--- +# Azure App Service ## Azure CLI sample scripts -The scripts in this directory demonstrate working with [Azure Container Registry][acr-home] using the [Azure CLI reference commands][azure-cli]. +The scripts in this directory demonstrate working with [Azure App Service][aas-home] using the [Azure CLI reference commands][azure-cli]. | Script | Description | | ------ | ----------- | |**Backup and restore app**|| -|[backup-restore.sh][acr-1]| Creates an App Service app and creates a one-time backup for it, creates a backup schedule for it, and then restores an App Service app from a backup. | +|[backup-restore.sh][aas-1]| Creates an App Service app and creates a one-time backup for it, creates a backup schedule for it, and then restores an App Service app from a backup. | |**Configure app**|| -|[configure-custom-domain-webapp-only.sh][acr-2]| Creates an App Service app and maps a custom domain name to it.| -|[configure-ssl-certificate-webapp-only.sh][acr-3]| Creates an App Service app and binds the TLS/SSL certificate of a custom domain name to it.| -|[configure-ssl-certificate.sh][acr-4]| | +|[configure-custom-domain-webapp-only.sh][aas-2]| Creates an App Service app and maps a custom domain name to it.| +|[configure-ssl-certificate-webapp-only.sh][aas-3]| Creates an App Service app and binds the TLS/SSL certificate of a custom domain name to it.| +|[configure-ssl-certificate.sh][aas-4]| | Creates an App Service app |**Connect app to resources**|| -|[connect-to-documentdb.sh][acr-5]| Creates an App Service app and an Azure Cosmos DB, then adds the Azure Cosmos DB connection details to the app settings. | -|[connect-to-redis.sh][acr-6]| Creates an App Service app and an Azure Cache for Redis, then adds the redis connection details to the app settings.| -|[connect-to-sql.sh][acr-7]| Creates an App Service app and a database in Azure SQL Database, then adds the database connection string to the app settings. | -|[connect-to-storage.sh][acr-8]| Creates an App Service app and a storage account, then adds the storage connection string to the app settings. | +|[connect-to-documentdb.sh][aas-5]| Creates an App Service app and an Azure Cosmos DB, then adds the Azure Cosmos DB connection details to the app settings. | +|[connect-to-redis.sh][aas-6]| Creates an App Service app and an Azure Cache for Redis, then adds the redis connection details to the app settings.| +|[connect-to-sql.sh][aas-7]| Creates an App Service app and a database in Azure SQL Database, then adds the database connection string to the app settings. | +|[connect-to-storage.sh][aas-8]| Creates an App Service app and a storage account, then adds the storage connection string to the app settings. | |**Create app**|| -|[deploy-deployment-slot.sh][acr-9]| Creates an App Service app with a deployment slot for staging code changes.| -|[deploy-ftp.sh][acr-10]| Creates an App Service app and deploys a file to it using FTP.| -|[deploy-github.sh][acr-11]| Creates an App Service app and deploys code from a public GitHub repository. | -|[deploy-linux-docker-webapp-only.sh][acr-12]| Creates an App Service app on Linux and loads a Docker image from Docker Hub.| -|[deploy-vsts-continuous-webapp-only.sh][acr-13]| Creates an App Service app with continuous publishing from a GitHub repository you own. | -|[integrate-with-app-gateway.sh][acr-14]| Creates an App Service app and configures code push into a local Git repository.| +|[deploy-deployment-slot.sh][aas-9]| Creates an App Service app with a deployment slot for staging code changes.| +|[deploy-ftp.sh][aas-10]| Creates an App Service app and deploys a file to it using FTP.| +|[deploy-github.sh][aas-11]| Creates an App Service app and deploys code from a public GitHub repository. | +|[deploy-linux-docker-webapp-only.sh][aas-12]| Creates an App Service app on Linux and loads a Docker image from Docker Hub.| +|[deploy-vsts-continuous-webapp-only.sh][aas-13]| Creates an App Service app with continuous publishing from a GitHub repository you own. | +|[integrate-with-app-gateway.sh][aas-14]| Creates an App Service app and configures code push into a local Git repository.| |**Monitor app**|| -|[monitor-with-logs.sh][acr-15]| Creates an App Service app, enables logging for it, and downloads the logs to your local machine.| +|[monitor-with-logs.sh][aas-15]| Creates an App Service app, enables logging for it, and downloads the logs to your local machine.| |**Scale app**|| -|[scale-geographic.sh][acr-16]| Creates two App Service apps in two different geographical regions and makes them available through a single endpoint using Azure Traffic Manager.| -|[scale-manual.sh][acr-17]| Creates an App Service app and scales it across 2 instances.| - - - - -Creates an App Service app and a Private Endpoint +|[scale-geographic.sh][aas-16]| Creates two App Service apps in two different geographical regions and makes them available through a single endpoint using Azure Traffic Manager.| +|[scale-manual.sh][aas-17]| Creates an App Service app and scales it across 2 instances.| -[acr-1]: ./backup-one-time-schedule-restore/backup-restore.sh -[acr-2]: ./configure-custom-domain/configure-custom-domain-webapp-only.sh -[acr-3]: ./configure-ssl-certificate/configure-ssl-certificate-webapp-only.sh -[acr-4]: ./configure-ssl-certificate/configure-ssl-certificate.sh -[acr-5]: ./connect-to-documentdb/connect-to-documentdb.sh -[acr-6]: ./connect-to-redis/connect-to-redis.sh -[acr-7]: ./connect-to-sql/connect-to-sql.sh -[acr-8]: ./connect-to-storage/connect-to-storage.sh -[acr-9]: ./deploy-deployment-slot/deploy-deployment-slot.sh -[acr-10]: ./deploy-ftp/deploy-ftp.sh -[acr-11]: ./deploy-github/deploy-github.sh -[acr-12]: ./deploy-linux-docker/deploy-linux-docker-webapp-only.sh -[acr-13]: ./deploy-vsts-continuous/deploy-vsts-continuous-webapp-only.sh -[acr-14]: ./integrate-with-app-gateway/integrate-with-app-gateway.sh -[acr-15]: ./monitor-with-logs/monitor-with-logs.sh -[acr-16]: ./scale-geographic/scale-geographic.sh -[acr-17]: ./scale-manual/scale-manual.sh +[aas-1]: ./backup-one-time-schedule-restore/backup-restore.sh +[aas-2]: ./configure-custom-domain/configure-custom-domain-webapp-only.sh +[aas-3]: ./configure-ssl-certificate/configure-ssl-certificate-webapp-only.sh +[aas-4]: ./configure-ssl-certificate/configure-ssl-certificate.sh +[aas-5]: ./connect-to-documentdb/connect-to-documentdb.sh +[aas-6]: ./connect-to-redis/connect-to-redis.sh +[aas-7]: ./connect-to-sql/connect-to-sql.sh +[aas-8]: ./connect-to-storage/connect-to-storage.sh +[aas-9]: ./deploy-deployment-slot/deploy-deployment-slot.sh +[aas-10]: ./deploy-ftp/deploy-ftp.sh +[aas-11]: ./deploy-github/deploy-github.sh +[aas-12]: ./deploy-linux-docker/deploy-linux-docker-webapp-only.sh +[aas-13]: ./deploy-vsts-continuous/deploy-vsts-continuous-webapp-only.sh +[aas-14]: ./integrate-with-app-gateway/integrate-with-app-gateway.sh +[aas-15]: ./monitor-with-logs/monitor-with-logs.sh +[aas-16]: ./scale-geographic/scale-geographic.sh +[aas-17]: ./scale-manual/scale-manual.sh -[acr-home]: https://azure.microsoft.com/services/container-registry/ +[aas-home]: https://azure.microsoft.com/services/container-registry/ [azure-cli]: https://learn.microsoft.com/en-us/cli/azure/reference-index diff --git a/app-service/backup-one-time-schedule-restore/README.md b/app-service/backup-one-time-schedule-restore/README.md new file mode 100644 index 00000000..3b44db0e --- /dev/null +++ b/app-service/backup-one-time-schedule-restore/README.md @@ -0,0 +1,50 @@ +--- +page_type: sample +languages: +- azurecli +products: +- azure +- azure-cli +- azure-app-service +name: Restore an app from a backup using the Azure CLI +url-fragment: +description: Learn how to use the Azure CLI to automate deployment and management of your App Service app. This sample shows how to restore an app from a backup. +--- +# Backup and restore a web app from a backup using the Azure CLI + +This sample script creates a web app in App Service with its related resources. It then creates a one-time backup for it, and also a scheduled backup for it. Finally, it restores the web app from backup. + +[!INCLUDE [quickstarts-free-trial-note](../includes/quickstarts-free-trial-note.md)] + +[!INCLUDE [azure-cli-prepare-your-environment.md](~/articles/reusable-content/azure-cli/azure-cli-prepare-your-environment.md)] + +## Sample script + +[!INCLUDE [cli-launch-cloud-shell-sign-in.md](../includes/cli-launch-cloud-shell-sign-in.md)] + +### Run the script + +:::code language="azurecli" source="~/azure_cli_scripts/app-service/backup-one-time-schedule-restore/backup-restore.sh" id="FullScript"::: + +## Clean up resources + +[!INCLUDE [cli-clean-up-resources.md](../includes/cli-clean-up-resources.md)] + +```azurecli +az group delete --name $resourceGroup +``` + +## Sample reference + +This script uses the following commands. Each command in the table links to command specific documentation. + +| Command | Notes | +|---|---| +| [`az webapp config backup list`](/cli/azure/webapp/config/backup#az-webapp-config-backup-list) | Gets a list of backups for a web app. | +| [`az webapp config backup restore`](/cli/azure/webapp/config/backup#az-webapp-config-backup-restore) | Restores a web app from a backup. | + +## Next steps + +For more information on the Azure CLI, see [Azure CLI documentation](/cli/azure). + +Additional App Service CLI script samples can be found in the [Azure App Service documentation](/azure/app-service/samples-cli). diff --git a/azure-front-door/deploy-custom-domain/README.md b/azure-front-door/deploy-custom-domain/README.md index 710f452f..4de0b8d4 100644 --- a/azure-front-door/deploy-custom-domain/README.md +++ b/azure-front-door/deploy-custom-domain/README.md @@ -40,4 +40,4 @@ The script will: [Deploying a static site using AZ CLI]: https://www.davepaquette.com/archive/2020/05/10/deploying-a-static-site-to-azure-using-the-az-cli.aspx [Add certificates in Key Vault]:https://docs.microsoft.com/en-us/azure/key-vault/certificates/create-certificate-signing-request?tabs=azure-portal#add-certificates-in-key-vault-issued-by-non-partnered-cas -[Host your domain in Azure DNS]:https://docs.microsoft.com/en-us/azure/dns/dns-delegate-domain-azure-dns +[Host your domain in Azure DNS]:https://docs.microsoft.com/en-us/azure/dns/dns-delegate-domain-azure-dns \ No newline at end of file From 013d3d661da18758c7a1651378647f90c260f5c1 Mon Sep 17 00:00:00 2001 From: dbradish-microsoft Date: Wed, 25 Oct 2023 16:19:35 -0400 Subject: [PATCH 2/2] testing onboard with Samples Browser --- .../Includes/cli-clean-up-resources.md | 9 ------- .../cli-launch-cloud-shell-sign-in.md | 27 ------------------- .../Includes/quickstarts-free-trial-note.md | 8 ------ 3 files changed, 44 deletions(-) delete mode 100644 app-service/Includes/cli-clean-up-resources.md delete mode 100644 app-service/Includes/cli-launch-cloud-shell-sign-in.md delete mode 100644 app-service/Includes/quickstarts-free-trial-note.md diff --git a/app-service/Includes/cli-clean-up-resources.md b/app-service/Includes/cli-clean-up-resources.md deleted file mode 100644 index 024c2f9f..00000000 --- a/app-service/Includes/cli-clean-up-resources.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -ms.topic: include -ms.date: 04/29/2022 -author: dbradish-microsoft -ms.author: dbradish -manager: barbkess ---- - -Use the following command to remove the resource group and all resources associated with it using the [az group delete](/cli/azure/group#az-group-delete) command - unless you have an ongoing need for these resources. Some of these resources may take a while to create, as well as to delete. diff --git a/app-service/Includes/cli-launch-cloud-shell-sign-in.md b/app-service/Includes/cli-launch-cloud-shell-sign-in.md deleted file mode 100644 index 1a196a75..00000000 --- a/app-service/Includes/cli-launch-cloud-shell-sign-in.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -ms.topic: include -ms.date: 01/05/2022 -author: dbradish-microsoft -ms.author: dbradish -manager: barbkess ---- - -### Launch Azure Cloud Shell - -The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account. - -To open the Cloud Shell, just select **Try it** from the upper right corner of a code block. You can also launch Cloud Shell in a separate browser tab by going to [https://shell.azure.com](https://shell.azure.com). - -When Cloud Shell opens, verify that **Bash** is selected for your environment. Subsequent sessions will use Azure CLI in a Bash environment, Select **Copy** to copy the blocks of code, paste it into the Cloud Shell, and press **Enter** to run it. - -### Sign in to Azure - -Cloud Shell is automatically authenticated under the initial account signed-in with. Use the following script to sign in using a different subscription, replacing `` with your Azure Subscription ID. [!INCLUDE [quickstarts-free-trial-note](quickstarts-free-trial-note.md)] - -```azurecli-interactive -subscription="" # add subscription here - -az account set -s $subscription # ...or use 'az login' -``` - -For more information, see [set active subscription](/cli/azure/account#az-account-set) or [log in interactively](/cli/azure/reference-index#az-login) diff --git a/app-service/Includes/quickstarts-free-trial-note.md b/app-service/Includes/quickstarts-free-trial-note.md deleted file mode 100644 index e98fe8f2..00000000 --- a/app-service/Includes/quickstarts-free-trial-note.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -author: SyntaxC4 -ms.service: cloud-services -ms.topic: include -ms.date: 01/18/2022 -ms.author: cfowler ---- -If you don't have an [Azure subscription](../articles/guides/developer/azure-developer-guide.md#understanding-accounts-subscriptions-and-billing), create an [Azure free account](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio) before you begin. \ No newline at end of file