azure cli를 통해 다음과 같이 Webapp 생성 및 git clone을 진행한다.
az group create --name myResourceGroup --location "East Asia"
az webapp deployment user set --user-name web-01 --password abcd
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku B1 --is-linux
az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name webapp-01 --runtime "PHP|8.1" --deployment-local-git
az webapp config appsettings set --name webapp-01 --resource-group myResourceGroup --settings DEPLOYMENT_BRANCH='main'
git clone https://github.com/Azure-Samples/App-Service-Troubleshoot-Azure-Monitor
cd App-Service-Troubleshoot-Azure-Monitor
git branch -m main
git remote add azure https://WebAppDeploy0510@webapp0510.scm.azurewebsites.net/WebApp0510.git
git push azure main
예시로, 다음과 같이 설정하였다.
앱 이름
WebApp0510
로그 작업영역
myMonitorWorkspace
다음과 같은 명령어를 통해 resourceID와 workspaceID를 구할 수 있다.
resourceID=$(az webapp show -g myResourceGroup -n WebApp0510 --query id --output tsv)
workspaceID=$(az monitor log-analytics workspace show -g myResourceGroup --workspace-name myMonitorWorkspace --query id --output tsv)

다음과 같은 메세지가 뜨면 웹페이지에 접근이 가능하다.
Local git is configured with url of 'https://WebAppDeploy0510@webapp0510.scm.azurewebsites.net/WebApp0510.git'
이제 다음과 같은 순서로 진행된다.
http://WebApp0510.azurewebsites.net에 접근하여 일부러 에러 메세지를 발생시켜보자. App Service에서 에러 강제 생성

Azure 웹 앱 > 로그로 접근하여 로그 기록 확인
다음과 같이 강제로 생성한 에러 로그 확인

process.php 파일을 수정하여 error 해결
확인할 수 있는 로그의 세부 정보들


Web app은 Application Insights와 연동이 가능하다.

Application Insights에서 확인할 수 있는 Metrics
