Monitoring Microsoft Dev Box
When you have critical applications and business processes relying on Azure resources, you want to monitor those resources for their availability, performance, and operation.
This article describes the monitoring data generated by Microsoft Dev Box. Microsoft Dev Box uses Azure Monitor. If you're unfamiliar with the features of Azure Monitor common to all Azure services that use it, read Monitoring Azure resources with Azure Monitor.
Monitoring data
Microsoft Dev Box collects the same kinds of monitoring data as other Azure resources that are described in Monitoring data from Azure resources.
See Monitoring Dev Box data reference for detailed information on the metrics and logs metrics created by Dev Box.
Collection and routing
Platform metrics and the Activity log are collected and stored automatically, but can be routed to other locations by using a diagnostic setting.
Resource Logs aren't collected and stored until you create a diagnostic setting and route them to one or more locations.
See Create diagnostic setting to collect platform logs and metrics in Azure for the detailed process for creating a diagnostic setting using the Azure portal, CLI, or PowerShell. When you create a diagnostic setting, you specify which categories of logs to collect. The categories for Dev box are listed in Microsoft Dev Box monitoring data reference.
Configure Azure diagnostic logs for a dev center
With Azure diagnostic logs for DevCenter, you can view audit logs for data plane operations in your dev center. These logs can be routed to any of the following destinations:
- Azure Storage account
- Log Analytics workspace
This feature is available on all dev centers.
Diagnostics logs allow you to export basic usage information from your dev center to different kinds sources so that you can consume them in a customized way. The data plane audit logs expose information around CRUD operations for dev boxes within your dev center. Including, for example, start and stop commands executed on dev boxes. Some sample ways you can choose to export this data:
- Export data to blob storage
- Export data to CSV
- Export data to Azure Monitor logs and view and query data in your own Log Analytics workspace
To learn more about the different types of logs available for dev centers, see DevCenter Diagnostic Logs Reference.
Enable logging with the Azure portal
Follow these steps enable logging for your Azure DevCenter resource:
Sign in to the Azure portal.
In the Azure portal, navigate to your dev center.
In the Monitoring section, select Diagnostics settings.
Select Add diagnostic setting in the open page.
Enable logging with Azure Storage
To use a storage account to store the logs, follow these steps:
Note
A storage account in the same region as your dev center is required to complete these steps. Refer to: Create an Azure Storage account for more information.
For Diagnostic setting name, enter a name for your diagnostic log settings.
Under Logs, select Dataplane audit logs.
Under Destination details, select Archive to a storage account.
Select the subscription and storage account for the logs.
Select Save.
Send to Log Analytics
To use Log Analytics for the logs, follow these steps:
Note
A log analytics workspace is required to complete these steps. Refer to: Create a Log Analytics workspace in the Azure portal for more information.
For Diagnostic setting name, enter a name for your diagnostic log settings.
Under Logs, select Dataplane audit logs.
Under Destination details, select Send to Log Analytics workspace.
Select the subscription and Log Analytics workspace for the logs.
Select Save.
Enable logging with PowerShell
The following example shows how to enable diagnostic logs via the Azure PowerShell Cmdlets.
Note
We recommend that you use the Azure Az PowerShell module to interact with Azure. To get started, see Install Azure PowerShell. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.
Enable diagnostic logs in a storage account
Sign in to Azure PowerShell:
Connect-AzAccount
Enable Diagnostic Logs in a storage account using the following commands. Replace the variables with your values:
$rg = <your-resource-group-name> $devcenterid = <your-devcenter-ARM-resource-id> $storageacctid = <your-storage-account-resource-id> $diagname = <your-diagnostic-setting-name> $log = New-AzDiagnosticSettingLogSettingsObject -Enabled $true -Category DataplaneAuditEvent -RetentionPolicyDay 7 -RetentionPolicyEnabled $true New-AzDiagnosticSetting -Name $diagname -ResourceId $devcenterid -StorageAccountId $storageacctid -Log $log
Enable diagnostics logs for Log Analytics workspace
Sign in to Azure PowerShell:
Connect-AzAccount
Enable Diagnostic Logs for a Log Analytics workspace using the following commands. Replace the variables with your values:
$rg = <your-resource-group-name> $devcenterid = <your-devcenter-ARM-resource-id> $workspaceid = <your-log-analytics-workspace-resource-id> $diagname = <your-diagnostic-setting-name> $log = New-AzDiagnosticSettingLogSettingsObject -Enabled $true -Category DataplaneAuditEvent -RetentionPolicyDay 7 -RetentionPolicyEnabled $true New-AzDiagnosticSetting -Name $diagname -ResourceId $devcenterid -WorkspaceId $workspaceid -Log $log
Analyzing Logs
This section describes existing tables for DevCenter diagnostic logs and how to query them.
All resource logs in Azure Monitor have the same fields followed by service-specific fields. The common schema is outlined in Common and service-specific schemas for Azure resource logs.
DevCenter stores data in the following tables.
Table | Description |
---|---|
DevCenterDiagnosticLogs | Table used to store data plane request/response information on dev box or environments within the dev center. |
DevCenterResourceOperationLogs | Operation logs pertaining to DevCenter resources, including information around resource health status changes. |
DevCenterBillingEventLogs | Billing event related to DevCenter resources. This log contains information about the quantity and unit charged per meter. |
Sample Kusto Queries
After enabling diagnostic settings on your dev center, you should be able to view audit logs for the tables within a log analytics workspace.
Here are some queries that you can enter into Log search to help your monitor your dev boxes.
To query for all data plane logs from DevCenter:
DevCenterDiagnosticLogs
To query for a filtered list of data plane logs, specific to a single devbox:
DevCenterDiagnosticLogs
| where TargetResourceId contains "<devbox-name>"
To generate a chart for data plane logs, grouped by operation result status:
DevCenterDiagnosticLogs
| summarize count() by OperationResult
| render piechart
These examples are just a small sample of the rich queries that can be performed in Monitor using the Kusto Query Language. For more information, see samples for Kusto queries.