Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@
[assembly: System.Reflection.AssemblyFileVersionAttribute("6.0.2")]
[assembly: System.Reflection.AssemblyVersionAttribute("6.0.2")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]

[assembly: System.CLSCompliantAttribute(false)]
17 changes: 4 additions & 13 deletions src/Monitor/DiagnosticSetting.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ title: DiagnosticSetting
module-version: 0.1.0
subject-prefix: DiagnosticSetting
namespace: Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting
nested-object-to-string: true

# If there are post APIs for some kinds of actions in the RP, you may need to
# uncomment following line to support viaIdentity for these post APIs
# identity-correction-for-post: true

# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
use-extension:
"@autorest/powershell": "3.x"

directive:
- where:
Expand Down Expand Up @@ -107,7 +98,7 @@ directive:
# 1. Remove the unexpanded parameter set
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This complex regex directive lacks a comment explaining its purpose. Based on CodingGuidelineID 1000002, all directives should have comments explaining the 'why'. Add a comment such as: '# Keep only Expanded, JsonFilePath, and JsonString parameter sets for Create and Update operations, removing unexpanded variants and CreateViaIdentityExpanded'.

Suggested change
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
# Keep only Expanded, JsonFilePath, and JsonString parameter sets for Create and Update operations,
# removing unexpanded variants and CreateViaIdentityExpanded to simplify the cmdlet surface and avoid unsupported scenarios.

Copilot uses AI. Check for mistakes.
- where:
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))|^CreateViaIdentityExpanded$
remove: true
# Remove Set cmdlet
- where:
Expand All @@ -129,7 +120,7 @@ directive:
subject-prefix: ""

- model-cmdlet:
- MetricSettings
- LogSettings
- SubscriptionLogSettings
- model-name: MetricSettings
- model-name: LogSettings
- model-name: SubscriptionLogSettings
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ Create an in-memory object for LogSettings.
Create an in-memory object for LogSettings.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.LogSettings
Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.LogSettings
.Link
https://learn.microsoft.com/powershell/module/Az.Monitor/new-AzDiagnosticSettingLogSettingsObject
https://learn.microsoft.com/powershell/module/Az.Monitor/new-azdiagnosticsettinglogsettingsobject
#>
function New-AzDiagnosticSettingLogSettingsObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.LogSettings')]
[Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.LogSettings')]
[CmdletBinding(PositionalBinding=$false)]
Param(

Expand All @@ -48,7 +49,7 @@ function New-AzDiagnosticSettingLogSettingsObject {
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.LogSettings]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.LogSettings]::New()

if ($PSBoundParameters.ContainsKey('Category')) {
$Object.Category = $Category
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ Create an in-memory object for MetricSettings.
Create an in-memory object for MetricSettings.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.MetricSettings
Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.MetricSettings
.Link
https://learn.microsoft.com/powershell/module/Az.Monitor/new-AzDiagnosticSettingMetricSettingsObject
https://learn.microsoft.com/powershell/module/Az.Monitor/new-azdiagnosticsettingmetricsettingsobject
#>
function New-AzDiagnosticSettingMetricSettingsObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.MetricSettings')]
[Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.MetricSettings')]
[CmdletBinding(PositionalBinding=$false)]
Param(

Expand All @@ -48,7 +49,7 @@ function New-AzDiagnosticSettingMetricSettingsObject {
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.MetricSettings]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.MetricSettings]::New()

if ($PSBoundParameters.ContainsKey('Category')) {
$Object.Category = $Category
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ Create an in-memory object for SubscriptionLogSettings.
Create an in-memory object for SubscriptionLogSettings.
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.SubscriptionLogSettings
Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.SubscriptionLogSettings
.Link
https://learn.microsoft.com/powershell/module/Az.Monitor/new-AzDiagnosticSettingSubscriptionLogSettingsObject
https://learn.microsoft.com/powershell/module/Az.Monitor/new-azdiagnosticsettingsubscriptionlogsettingsobject
#>
function New-AzDiagnosticSettingSubscriptionLogSettingsObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.SubscriptionLogSettings')]
[Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.SubscriptionLogSettings')]
[CmdletBinding(PositionalBinding=$false)]
Param(

Expand All @@ -42,7 +43,7 @@ function New-AzDiagnosticSettingSubscriptionLogSettingsObject {
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.SubscriptionLogSettings]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.SubscriptionLogSettings]::New()

if ($PSBoundParameters.ContainsKey('Category')) {
$Object.Category = $Category
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The current list includes the following: Administrative, Security, ServiceHealth
Gets the active subscription diagnostic settings for the specified resource.

### [New-AzDiagnosticSetting](New-AzDiagnosticSetting.md)
Creates or updates diagnostic settings for the specified resource.
Create diagnostic settings for the specified resource.

### [New-AzDiagnosticSettingLogSettingsObject](New-AzDiagnosticSettingLogSettingsObject.md)
Create an in-memory object for LogSettings.
Expand All @@ -37,11 +37,17 @@ Create an in-memory object for MetricSettings.
Create an in-memory object for SubscriptionLogSettings.

### [New-AzSubscriptionDiagnosticSetting](New-AzSubscriptionDiagnosticSetting.md)
Creates or updates subscription diagnostic settings for the specified resource.
Create subscription diagnostic settings for the specified resource.

### [Remove-AzDiagnosticSetting](Remove-AzDiagnosticSetting.md)
Deletes existing diagnostic settings for the specified resource.

### [Remove-AzSubscriptionDiagnosticSetting](Remove-AzSubscriptionDiagnosticSetting.md)
Deletes existing subscription diagnostic settings for the specified resource.

### [Update-AzDiagnosticSetting](Update-AzDiagnosticSetting.md)
Update diagnostic settings for the specified resource.

### [Update-AzSubscriptionDiagnosticSetting](Update-AzSubscriptionDiagnosticSetting.md)
Update subscription diagnostic settings for the specified resource.

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Accept wildcard characters: False

### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.IDiagnosticSettingIdentity
Expand Down Expand Up @@ -122,7 +121,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.IDiagnosticSettingsResource
### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.IDiagnosticSettingsResource

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ Accept wildcard characters: False

### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.IDiagnosticSettingIdentity
Expand Down Expand Up @@ -115,7 +114,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.IDiagnosticSettingsCategoryResource
### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.IDiagnosticSettingsCategoryResource

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20150401.ILocalizableString
### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.ILocalizableString

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Accept wildcard characters: False

### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.IDiagnosticSettingIdentity
Expand Down Expand Up @@ -122,7 +121,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.ISubscriptionDiagnosticSettingsResource
### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.ISubscriptionDiagnosticSettingsResource

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ schema: 2.0.0
# New-AzDiagnosticSetting

## SYNOPSIS
Creates or updates diagnostic settings for the specified resource.
Create diagnostic settings for the specified resource.

## SYNTAX

### CreateExpanded (Default)
```
New-AzDiagnosticSetting -Name <String> -ResourceId <String> [-EventHubAuthorizationRuleId <String>]
[-EventHubName <String>] [-Log <ILogSettings[]>] [-LogAnalyticsDestinationType <String>]
Expand All @@ -20,8 +21,20 @@ New-AzDiagnosticSetting -Name <String> -ResourceId <String> [-EventHubAuthorizat
[<CommonParameters>]
```

### CreateViaJsonFilePath
```
New-AzDiagnosticSetting -Name <String> -ResourceId <String> -JsonFilePath <String>
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
```

### CreateViaJsonString
```
New-AzDiagnosticSetting -Name <String> -ResourceId <String> -JsonString <String> [-DefaultProfile <PSObject>]
[-Confirm] [-WhatIf] [<CommonParameters>]
```

## DESCRIPTION
Creates or updates diagnostic settings for the specified resource.
Create diagnostic settings for the specified resource.

## EXAMPLES

Expand Down Expand Up @@ -72,7 +85,7 @@ The resource Id for the event hub authorization rule.

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -88,7 +101,7 @@ If none is specified, the default event hub will be selected.

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -98,13 +111,42 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -JsonFilePath
Path of Json file supplied to the Create operation

```yaml
Type: System.String
Parameter Sets: CreateViaJsonFilePath
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -JsonString
Json string supplied to the Create operation

```yaml
Type: System.String
Parameter Sets: CreateViaJsonString
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Log
The list of logs settings.
To construct, see NOTES section for LOG properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.ILogSettings[]
Parameter Sets: (All)
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.ILogSettings[]
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -121,7 +163,7 @@ Possible values are: Dedicated and null (null is default.)

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -136,7 +178,7 @@ The full ARM resource ID of the Marketplace resource to which you would like to

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -148,11 +190,10 @@ Accept wildcard characters: False

### -Metric
The list of metric settings.
To construct, see NOTES section for METRIC properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.IMetricSettings[]
Parameter Sets: (All)
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.IMetricSettings[]
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand Down Expand Up @@ -198,7 +239,7 @@ This is here to maintain backwards compatibility.

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -213,7 +254,7 @@ The resource ID of the storage account to which you would like to send Diagnosti

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -229,7 +270,7 @@ Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insi

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand Down Expand Up @@ -277,7 +318,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.IDiagnosticSettingsResource
### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.IDiagnosticSettingsResource

## NOTES

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file:
Module Name: Az.Monitor
online version: https://learn.microsoft.com/powershell/module/Az.Monitor/new-AzDiagnosticSettingLogSettingsObject
online version: https://learn.microsoft.com/powershell/module/Az.Monitor/new-azdiagnosticsettinglogsettingsobject
schema: 2.0.0
---

Expand Down Expand Up @@ -116,7 +116,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.Api20210501Preview.LogSettings
### Microsoft.Azure.PowerShell.Cmdlets.Monitor.DiagnosticSetting.Models.LogSettings

## NOTES

Expand Down
Loading