You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/troubleshooting/enable-debug-logging.md
+92-14Lines changed: 92 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,37 +1,65 @@
1
1
---
2
2
title: Enable debug logging
3
-
description: Describes how to enable debug logging to troubleshoot Azure resources deployed with Azure Resource Manager templates (ARM templates) or Bicep files.
3
+
description: Describes how to enable debug logging to troubleshoot Azure resources deployed with Bicep files or Azure Resource Manager templates (ARM templates).
4
4
tags: top-support-issue
5
5
ms.topic: troubleshooting
6
-
ms.date: 11/05/2021
6
+
ms.date: 06/20/2022
7
7
ms.custom: devx-track-azurepowershell
8
8
---
9
9
10
10
# Enable debug logging
11
11
12
-
To troubleshoot a deployment error, it helps to gather more information. Use Azure PowerShell to enable debug logging. You can get data about a deployment's request and response to learn the cause of the problem. Debug logging works with Azure Resource Manager templates (ARM templates) and Bicep files.
12
+
To troubleshoot a deployment error, enable debug logging to get more information. Debug logging works for deployments using Bicep files or Azure Resource Manager templates (ARM templates). You can get data about a deployment's request and response to learn the cause of a problem.
13
13
14
-
## Get debug information
14
+
> [!WARNING]
15
+
> Debug logging can expose secrets like passwords or `listKeys`. Only enable debug logging when you need to troubleshoot a deployment error.
16
+
17
+
## Set up debug logging
18
+
19
+
Use Azure PowerShell to enable debug logging and view the results with Azure PowerShell or Azure CLI.
15
20
16
21
# [PowerShell](#tab/azure-powershell)
17
22
18
-
Use [New-AzResourceGroupDeployment](/powershell/module/az.resources/new-azresourcegroupdeployment) to set the `DeploymentDebugLogLevel` parameter to `All`, `ResponseContent`, or `RequestContent`. When debug logging is enabled, a warning is displayed that secrets like passwords or `listKeys` can be logged by commands like [Get-AzResourceGroupDeploymentOperation](/powershell/module/az.resources/get-azresourcegroupdeploymentoperation).
23
+
For a resource group deployment, use [New-AzResourceGroupDeployment](/powershell/module/az.resources/new-azresourcegroupdeployment) to set the `DeploymentDebugLogLevel` parameter to `All`, `ResponseContent`, or `RequestContent`.
24
+
25
+
When debug logging is enabled, a warning is displayed that secrets like passwords or `listKeys` can be logged and displayed when you get deployment operations with commands like `Get-AzResourceGroupDeploymentOperation`.
You can't enable debug logging with Azure CLI but you can get debug logging data using the `request` and `response` properties.
51
+
52
+
53
+
---
54
+
55
+
56
+
## Get debug information
57
+
58
+
After debug logging is enabled, you can get more information from the deployment operations.
59
+
60
+
# [PowerShell](#tab/azure-powershell)
61
+
62
+
For a resource group deployment, use [Get-AzResourceGroupDeploymentOperation](/powershell/module/az.resources/get-azresourcegroupdeploymentoperation) to get deployment operations.
35
63
36
64
```azurepowershell
37
65
Get-AzResourceGroupDeploymentOperation `
@@ -47,19 +75,24 @@ You can specify a property, like `StatusMessage` or `StatusCode` to filter the o
47
75
-ResourceGroupName examplegroup).StatusMessage
48
76
```
49
77
78
+
For more information, see the documentation for deployment operation scopes: subscription, management group, and tenant.
You can't enable debug logging with Azure CLI but you can retrieve debug logging data.
86
+
For a resource group deployment, use [az deployment operation group list](/cli/azure/deployment/operation/group#az-deployment-operation-group-list) to get deployment operations.
53
87
54
-
Get the deployment operations with the [az deployment operation group list](/cli/azure/deployment/operation/group#az-deployment-operation-group-list) command:
55
88
56
89
```azurecli
57
90
az deployment operation group list \
58
91
--resource-group examplegroup \
59
92
--name exampledeployment
60
93
```
61
94
62
-
Get the request content with the following command:
95
+
Use a query to get the `request` property's content.
63
96
64
97
```azurecli
65
98
az deployment operation group list \
@@ -68,7 +101,7 @@ az deployment operation group list \
68
101
--query [].properties.request
69
102
```
70
103
71
-
Get the response content with the following command:
104
+
Use a query to get the `response` property's content.
72
105
73
106
```azurecli
74
107
az deployment operation group list \
@@ -77,11 +110,56 @@ az deployment operation group list \
77
110
--query [].properties.response
78
111
```
79
112
113
+
For more information, see the documentation for deployment operation scopes: subscription, management group, and tenant.
114
+
115
+
-[az deployment operation sub list](/cli/azure/deployment/operation/sub#az-deployment-operation-sub-list)
When you're finished debugging, you can remove deployment history to prevent anyone who has access from seeing sensitive information that might have been logged. If you used multiple deployment names during debugging, run the command for each deployment name.
125
+
126
+
# [PowerShell](#tab/azure-powershell)
127
+
128
+
To remove deployment history for a resource group deployment, use [Remove-AzResourceGroupDeployment](/powershell/module/az.resources/remove-azresourcegroupdeployment).
To remove deployment history for a resource group deployment, use [az deployment group delete](/cli/azure/deployment/group#az-deployment-group-delete).
146
+
147
+
```azurecli
148
+
az deployment group delete --resource-group examplegroup --name exampledeployment
149
+
```
150
+
151
+
For more information, see the documentation for deployment scopes: subscription, management group, and tenant.
152
+
153
+
-[az deployment sub delete](/cli/azure/deployment/sub#az-deployment-sub-delete)
To log debug information for a [nested](../templates/linked-templates.md#nested-template) ARM template, use the [Microsoft.Resources/deployments](/azure/templates/microsoft.resources/deployments)`debugSetting`element.
162
+
To log debug information for a [nested](../templates/linked-templates.md#nested-template) ARM template, use the [Microsoft.Resources/deployments](/azure/templates/microsoft.resources/deployments)`debugSetting`property.
85
163
86
164
```json
87
165
{
@@ -101,7 +179,7 @@ To log debug information for a [nested](../templates/linked-templates.md#nested-
101
179
}
102
180
```
103
181
104
-
Bicep uses [modules](../bicep/modules.md) rather than `Microsoft.Resources/deployments`. With modules, you can reuse your code to deploy a Bicep file from another Bicep file.
182
+
Bicep uses [modules](../bicep/modules.md) rather than nested templates.
0 commit comments