Edit

Share via


Update-AzDiagnosticSetting

Update diagnostic settings for the specified resource.

Syntax

UpdateExpanded (Default)

Update-AzDiagnosticSetting
    -Name <String>
    -ResourceId <String>
    [-EventHubAuthorizationRuleId <String>]
    [-EventHubName <String>]
    [-Log <ILogSettings[]>]
    [-LogAnalyticsDestinationType <String>]
    [-MarketplacePartnerId <String>]
    [-Metric <IMetricSettings[]>]
    [-ServiceBusRuleId <String>]
    [-StorageAccountId <String>]
    [-WorkspaceId <String>]
    [-DefaultProfile <PSObject>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

UpdateViaIdentityExpanded

Update-AzDiagnosticSetting
    -InputObject <IDiagnosticSettingIdentity>
    [-EventHubAuthorizationRuleId <String>]
    [-EventHubName <String>]
    [-Log <ILogSettings[]>]
    [-LogAnalyticsDestinationType <String>]
    [-MarketplacePartnerId <String>]
    [-Metric <IMetricSettings[]>]
    [-ServiceBusRuleId <String>]
    [-StorageAccountId <String>]
    [-WorkspaceId <String>]
    [-DefaultProfile <PSObject>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Update diagnostic settings for the specified resource.

Examples

Example 1: Update diagnostic setting

$newlog = New-AzDiagnosticSettingLogSettingsObject -Enabled $false -Category 'VMProtectionAlerts'
$newmetric = New-AzDiagnosticSettingMetricSettingsObject -Enabled $false -Category 'AllMetrics'
Update-AzDiagnosticSetting -Name diagnosticSettingName -ResourceId 'vnetId' -Log $newlog -Metric $newmetric

These commands update diagnostic setting for resource with log analytics workspace as destination.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRMContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EventHubAuthorizationRuleId

The resource Id for the event hub authorization rule.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EventHubName

The name of the event hub. If none is specified, the default event hub will be selected.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Identity Parameter

Parameter properties

Type:IDiagnosticSettingIdentity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UpdateViaIdentityExpanded
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Log

The list of logs settings.

Parameter properties

Type:

ILogSettings[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-LogAnalyticsDestinationType

A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: <normalized service identity>_<normalized category name>. Possible values are: Dedicated and null (null is default.)

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MarketplacePartnerId

The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Metric

The list of metric settings.

Parameter properties

Type:

IMetricSettings[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The name of the diagnostic setting.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UpdateExpanded
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceId

The identifier of the resource.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UpdateExpanded
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ServiceBusRuleId

The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StorageAccountId

The resource ID of the storage account to which you would like to send Diagnostic Logs.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WorkspaceId

The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

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

Inputs

IDiagnosticSettingIdentity

Outputs

IDiagnosticSettingsResource