Yes, setting up a Log Analytics Workspace is essential for collecting and analyzing data for Azure Monitor Workbooks. Without it, you cannot query AVD session data or other logs. Here’s a step-by-step guide to ensure your Log Analytics Workspace is correctly set up:
Step 1: Create a Log Analytics Workspace
- Log in to the Azure portal.
- In the search bar, type Log Analytics Workspaces and select it.
- Click + Create to create a new workspace.
- Provide the following information:
- Subscription: Choose the subscription to associate the workspace.
- Resource Group: Select an existing resource group or create a new one.
- Name: Give your workspace a meaningful name (e.g.,
AVD-Workspace). - Region: Select the same region as your AVD environment for optimal performance.
- Click Review + Create, then Create.
Step 2: Enable Diagnostics Settings for AVD
- Navigate to your Azure Virtual Desktop (AVD) host pool or session host in the Azure portal.
- Under Monitoring, select Diagnostics settings.
- Click + Add Diagnostic Setting.
- Configure the diagnostic settings:
- Name: Provide a name (e.g.,
AVD-Diagnostics). - Log Analytics Workspace: Select the Log Analytics Workspace you just created.
- Name: Provide a name (e.g.,
- Select the specific logs to send to the workspace:
- ConnectionLogs
- ManagementLogs
- ErrorLogs
- Save the diagnostic settings.
Step 3: Verify Data Collection
- Go to your Log Analytics Workspace in the Azure portal.
- Under General, select Logs.
- Run a simple query to verify data is being collected. For example:
WVDConnections | limit 10- If the query returns results, data collection is working correctly.
- If no results are returned, ensure:
- Diagnostics are enabled for the AVD resources.
- Logs are being sent to the correct workspace.
Step 4: Optimize Log Retention (Optional)
- In the Log Analytics Workspace, go to Usage and estimated costs.
- Adjust the Retention Period to balance cost and data retention needs.
Step 5: Use the Workspace in Azure Monitor Workbook
- Open Monitor in the Azure portal.
- Select Workbooks and start creating your workbook.
- When adding queries, ensure you select the Log Analytics Workspace where your AVD data is stored.
Step 6: Automate Log Analytics Setup (Optional)
For repeated deployments, you can use Azure Resource Manager (ARM) templates, Bicep, or Terraform to automate the setup of Log Analytics and diagnostics.