Get-AzureResourceGroupLog

Get-AzureResourceGroupLog

Gets the deployment log for a resource group

Syntax

Parameter Set: Last deployment
Get-AzureResourceGroupLog [-Name] <String> [ <CommonParameters>]

Parameter Set: All
Get-AzureResourceGroupLog [-Name] <String> [-All] [ <CommonParameters>]

Parameter Set: Deployment by name
Get-AzureResourceGroupLog [-Name] <String> -DeploymentName <String> [ <CommonParameters>]

Detailed Description

The Get-AzureResourceGroupLog cmdlet gets the deployment log entries for a resource group. The entries are very useful for many IT tasks, including maintaining a transaction history, performing statistical analyses, and debugging.

By default, Get-AzureResourceGroupLog gets the log entries of the currently running or most recently completed deployment for the resource group, but you can use the cmdlet parameters to get the entries for a particular deployment by name or all deployments.

Parameters

-All

Gets all deployment log entries for the resource group.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DeploymentName<String>

Gets the log entries for the deployment with the specified name.

To get the names of deployment for a resource group, use the Get-AzureResourceGroupDeployment cmdlet. To specify a deployment name when deploying resources, use the DeploymentName parameter of New-AzureResourceGroup or the Name parameter (alias DeploymentName) of the New-AzureResourceGroupDeployment cmdlets.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of a resource group. This parameter is required. Enter the name of one resource group in each command.

Aliases

ResourceGroupName

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

    You can pipe input to this cmdlet by property name, but not by value.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Azure.Commands.ResourceManagement.Models.PSDeploymentEventData

Notes

  • The Get-AzureResourceGroupLog cmdlet is included in the Azure Resource Manager module beginning in module version 0.8.0.

Examples

Example 1: Get the log entries for the most recent deployment

This command gets the log entries of the currently running or most recently completed deployment of the ContosoRG01 resource group. In this case, the log entries records the addition of a new web site.

PS C:\> Get-AzureResourceGroupLog -Name ContosoRG01
Authorization     : 
Scope : /subscriptions/9b14a38b-4b93-4554-8bb0-3cefb47a4e1f/resourcegroups/ContosoLabsRG/deployments/LabDeploy02
Action : Microsoft.Resources/subscriptions/resourcegroups/deployments/write
Role : Subscription Admin
Condition :
ResourceUri : /subscriptions/9b14a38b-4b93-4554-8bb0-3cefb47a4e1f/resourcegroups/ContosoLabsRG/deployments/LabDeploy02
SubscriptionId : 9b14a38b-4b93-4554-8bb0-3cefb47a4e1f
Timestamp(UTC) : 3/21/2014 9:17:33 PM
OperationName : Update deployment
OperationId : 4877e67f-868b-4b3e-8778-4a40ee3a1af2
Status : Succeeded
SubStatus : Created
Caller : live.com#auxtm702@live.com
CorrelationId : 4877e67f-868b-4b3e-8778-4a40ee3a1af2Description :
HttpRequest :
ClientId :
Method : PUT
Url :
ClientIpAddress : 131.107.192.39
Level : Informational
ResourceGroupName : ContosoLabsRG
ResourceProvider : Microsoft Resources
EventSource : Microsoft Resources
Properties :
statusCode : Created

Example 2: Get log entries by deployment name

These commands get the log entries of the LabDeploy02 deployment of the ContosoLabsRG resource group.

The first command uses the Get-AzureResourceGroupDeployment cmdlet to get all deployments for the ContosoLabsRG resource group. It uses the dot method to get the DeploymentName property of each deployment. Notice that the name of the first deployment is a template name, which is the default value when you do not specify a deployment name.

The second command uses the Get-AzureResourceGroupLog cmdlet to get the log entries for the LabDeploy02 deployment.

PS C:\> (Get-AzureResourceGroupDeployment -ResourceGroupName ContosoLabsRG).DeploymentName

Microsoft.WebSiteSQLDatabase.0.1.0-preview1
LabDeploy02
LabDeploy03

PS C:\>Get-AzureResourceGroupLog -Name ContosoLabsRG -DeploymentName LabDeploy02

Example 3: Get all failing log entries for a resource group

This command gets all log entries of failed operations for the ContosoRG01 resource group. You might use a command like this for debugging.

The first command uses the All parameter of the Get-AzureResourceGroupLog to get log entries for all deployments of the resource group. Then it pipes the log entries to the Where-Object cmdlet, which selects only entries that have a value of Failed for the Status property

PS C:\> Get-AzureResourceGroupLog -Name ContosoRG01 -All | Where-Object Status -eq Failed

Example 3: Get the logs of the most recent deployment for each resource group

This command gets the log entries for the most recent deployment of each resource group in the subscription. The command uses the Get-AzureResourceGroup cmdlet to get all resource groups in the subscription. It pipes the resources groups to the Get-AzureResourceGroupLog which gets the log entries for the last deployment of each resource group.

PS C:\> Get-AzureResourceGroup | Get-AzureResourceGroupLog