Fetching contributors…
Cannot retrieve contributors at this time
57 lines (41 sloc) 2.38 KB

title: Azure PowerShell Script Sample - Monitor a web app with web server logs | Microsoft Docs description: Azure PowerShell Script Sample - Monitor a web app with web server logs services: app-service\web documentationcenter: author: syntaxc4 manager: erikre editor: tags: azure-service-management

ms.assetid: 5805d7cd-9e56-4eba-bd85-75b013690ff5 ms.service: app-service ms.devlang: multiple ms.topic: sample ms.tgt_pltfrm: na ms.workload: web 03/20/2017 cfowler ms.custom: mvc

Monitor a web app with web server logs

In this scenario you will create a resource group, app service plan, web app and configure the web app to enable web server logs. You will then download the log files for review.

If needed, install the Azure PowerShell using the instruction found in the Azure PowerShell guide, and then run Connect-AzureRmAccount to create a connection with Azure.

Sample script


Clean up deployment

After the script sample has been run, the following command can be used to remove the resource group, web app, and all related resources.

Remove-AzureRmResourceGroup -Name myResourceGroup -Force

Script explanation

This script uses the following commands. Each command in the table links to command specific documentation.

Command Notes
New-AzureRmResourceGroup Creates a resource group in which all resources are stored.
New-AzureRmAppServicePlan Creates an App Service plan.
New-AzureRmWebApp Creates a web app.
Set-AzureRmWebApp Modifies a web app's configuration.
Get-AzureRMWebAppMetrics Gets a web app's metrics.

Next steps

For more information on the Azure PowerShell module, see Azure PowerShell documentation.

Additional Azure Powershell samples for Azure App Service Web Apps can be found in the Azure PowerShell samples.