Sdílet prostřednictvím


Set-AzureRmDiagnosticSetting

Applies To: Azure PowerShell 1.0

Set-AzureRmDiagnosticSetting

Sets the logs and metrics settings for the resource.

Syntax

Parameter Set: Default
Set-AzureRmDiagnosticSetting -Enabled <Boolean> -ResourceId <String> -StorageAccountId <String> [-Categories <0, Culture=neutral, PublicKeyToken=b77a5c561934e089> ] [-Timegrains <0, Culture=neutral, PublicKeyToken=b77a5c561934e089> ] [ <CommonParameters>]

Detailed Description

This command enables or disables each timegrain and log category for the particular resource. The logs and metrics will be stored in the defined storage account.

Parameters

-Categories<0, Culture=neutral, PublicKeyToken=b77a5c561934e089>

The list of log categories to be enabled or disabled, according to the value in -Enable. If no category is specified, this command assumes all categories.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Enabled<Boolean>

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-ResourceId<String>

The id of the resource.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-StorageAccountId<String>

The id of the storage account where the data will be saved to.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Timegrains<0, Culture=neutral, PublicKeyToken=b77a5c561934e089>

The list of timegrains to be enabled or disabled for metrics, according to the value in -Enable. If no timegrain is specified, this command assumes all available timegrains.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

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

Outputs

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

Examples

-------------------------- Enabling all --------------------------

This will enable all available metrics and logs for the resource.

PS C:\> Set-AzureRmDiagnosticSetting -ResourceId <resourceId> -Enable $true

-------------------------- Disabling all --------------------------

This will disable all available metrics and logs for the resource <resourceName>.

PS C:\> Set-AzureRmDiagnosticSetting -ResourceId <resourceId> -Enable $false

-------------------------- Enabling some categories --------------------------

This will enable only Category1 and Category2. All timegrains and other categories will remain the same. StorageAccountId : <storageAccountId> StorageAccountName : <storageAccountName> Metrics Enabled : True Timegrain : PT1M Enabled : True Timegrain : PT1H Logs Enabled : True Category : Category1 Enabled : True Category : Category2 Enabled : True Category : Category3 Enabled : False Category : Category4

PS C:\> Set-AzureRmDiagnosticSetting -ResourceId <resourceId> -Enable $true -Categories Category1,Category2

-------------------------- Enabling some timegrains and categories --------------------------

This will enable only Category1, Category2 and timegrain PT1M. All timegrains and other categories will remain the same.

PS C:\> Set-AzureRmDiagnosticSetting -ResourceId <resourceId> -Enable $true -Categories Category1,Category2 -Timegrains PT1M