From 6e7a93b1eff6469ccee361313ccf7f7500a87279 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Thu, 16 Apr 2020 13:49:08 +0800 Subject: [PATCH 01/10] remove redundant retentionpolicy --- src/Monitor/Monitor/OutputClasses/PSLogProfile.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Monitor/Monitor/OutputClasses/PSLogProfile.cs b/src/Monitor/Monitor/OutputClasses/PSLogProfile.cs index 91a51b11c2dc..bc389f285c13 100644 --- a/src/Monitor/Monitor/OutputClasses/PSLogProfile.cs +++ b/src/Monitor/Monitor/OutputClasses/PSLogProfile.cs @@ -21,11 +21,6 @@ namespace Microsoft.Azure.Commands.Insights.OutputClasses /// public class PSLogProfile : LogProfileResource { - /// - /// Gets or sets the RetentionPolicy of the LogProfile - /// - public new Management.Monitor.Management.Models.RetentionPolicy RetentionPolicy { get; set; } - /// /// Initializes a new instance of the class. /// From 7c27b8dd6ed13650c0c6c5b16264829783aa154e Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Thu, 16 Apr 2020 17:25:44 +0800 Subject: [PATCH 02/10] update changelog.md --- src/Monitor/Monitor/ChangeLog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Monitor/Monitor/ChangeLog.md b/src/Monitor/Monitor/ChangeLog.md index 883954507f6c..77b94743608e 100644 --- a/src/Monitor/Monitor/ChangeLog.md +++ b/src/Monitor/Monitor/ChangeLog.md @@ -27,6 +27,8 @@ - `Get-AzInsightsPrivateLinkScopedResource` - `New-AzInsightsPrivateLinkScopedResource` - `Remove-AzInsightsPrivateLinkScopedResource` +* Removed redundant definition for RetentionPolicy in PSLogProfile. Issue: https://github.com/Azure/azure-powershell/issues/7608 +* Removed redundant properties difined in PSEventData. Issue: https://github.com/Azure/azure-powershell/issues/11353 ## Version 1.6.2 * Updated documentation for `New-AzScheduledQueryRuleLogMetricTrigger` From b12a4d96c3130fe6cb79fe68650254350fd36e85 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Mon, 20 Apr 2020 18:33:36 +0800 Subject: [PATCH 03/10] rename Get-AzLog to Get-AzActivityLog --- .../ScenarioTests/ActivityLogsTests.ps1 | 28 ++--- .../ActivityLogs/GetAzureRmLogCommand.cs | 2 +- src/Monitor/Monitor/Az.Monitor.psd1 | 2 +- src/Monitor/Monitor/ChangeLog.md | 1 + .../{Get-AzLog.md => Get-AzActivityLog.md} | 112 +++++++++--------- 5 files changed, 70 insertions(+), 75 deletions(-) rename src/Monitor/Monitor/help/{Get-AzLog.md => Get-AzActivityLog.md} (68%) diff --git a/src/Monitor/Monitor.Test/ScenarioTests/ActivityLogsTests.ps1 b/src/Monitor/Monitor.Test/ScenarioTests/ActivityLogsTests.ps1 index c58bf47e9e0d..52b4591f3588 100644 --- a/src/Monitor/Monitor.Test/ScenarioTests/ActivityLogsTests.ps1 +++ b/src/Monitor/Monitor.Test/ScenarioTests/ActivityLogsTests.ps1 @@ -27,32 +27,32 @@ function Test-GetAzureLogAllParameters try { Write-Verbose " ****** Get ActivityLog records by corrrelationId " - $actual = Get-AzLog -CorrelationId $correlation -starttime 2015-03-02T18:00:00Z -endtime 2015-03-02T20:00:00Z -detailedOutput + $actual = Get-AzActivityLog -CorrelationId $correlation -starttime 2015-03-02T18:00:00Z -endtime 2015-03-02T20:00:00Z -detailedOutput # Assert TODO add more asserts Assert-AreEqual 2 $actual.Count Write-Verbose " ****** Get ActivityLog records by resource group " - $actual = Get-AzLog -ResourceGroup $rgname -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z + $actual = Get-AzActivityLog -ResourceGroup $rgname -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z # Assert TODO add more asserts Assert-AreEqual 2 $actual.Count Write-Verbose " ****** Get ActivityLog records by resource Id" - $actual = Get-AzLog -ResourceId $rname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z + $actual = Get-AzActivityLog -ResourceId $rname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z # Assert TODO add more asserts # Assert-Throws { Set-AzureResourceGroup -Name $rgname -Tags @{"testtag" = "testval"} } "Invalid tag format. Expect @{Name = `"tagName`"} or @{Name = `"tagName`"; Value = `"tagValue`"}" Assert-AreEqual 2 $actual.Count Write-Verbose " ****** Get ActivityLog records by resource provider" - $actual = Get-AzLog -ResourceProvider $rpname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z + $actual = Get-AzActivityLog -ResourceProvider $rpname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z # Assert Assert-AreEqual 2 $actual.Count Write-Verbose " ****** Get ActivityLog records by subscription Id" - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z # Assert Assert-AreEqual 1 $actual.Count @@ -77,26 +77,26 @@ function Test-GetAzureSubscriptionIdLogMaxEvents { # There are 7 elements in the recorded sessions. The page is set to 6 elements. # So if this succeeds, the command is using the default MaxEvent and following continuation token. - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z Assert-AreEqual 7 $actual.Count } { # There are 7 elements in the recorded sessions. The page is set to 6 elements. # So if this succeeds, the command is using the default MaxEvent and following continuation token. - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents -3 + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents -3 Assert-AreEqual 7 $actual.Count } { # There are 7 elements in the recorded sessions. The page is set to 6 elements. # So if this succeeds, the command is using the default MaxEvent and following continuation token. - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 0 + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 0 Assert-AreEqual 7 $actual.Count } { - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 3 + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 3 Assert-AreEqual 3 $actual.Count } } @@ -120,35 +120,35 @@ function Test-GetAzureSubscriptionIdLogPaged { # There are 8 elements in the recorded sessions. The page is set to 6 elements. # So if this succeeds, the commands is following the continuation token to get the records in the second page. - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z Assert-AreEqual 8 $actual.Count } { # There are 8 elements in the recorded sessions. The page is set to 6 elements. # So if this succeeds, the commands is following the continuation token to get only one record in the second page. - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 7 + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 7 Assert-AreEqual 7 $actual.Count } { # There are 8 elements in the recorded sessions. The page is set to 6 elements. # So if this succeeds, the commands could have followed the continuation token but did not because it reached MaxEvents first. - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 6 + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 6 Assert-AreEqual 6 $actual.Count } { # There are 8 elements in the recorded sessions. The page is set to 6 elements. # So if this succeeds, the commands could have followed the continuation token but did not because it reached MaxEvents first. - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 3 + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 3 Assert-AreEqual 3 $actual.Count } { # There are 8 elements in the recorded sessions. The page is set to 6 elements. # So if this succeeds, the commands is following the continuation token to get the records in the second page and reached the last record before reaching MaxEvents. - $actual = Get-AzLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 15 + $actual = Get-AzActivityLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z -MaxEvents 15 Assert-AreEqual 8 $actual.Count } } diff --git a/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs b/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs index fddf8a83cce0..af98578e9f11 100644 --- a/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs +++ b/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.Insights.Events /// /// Get the list of events for at a subscription level. /// - [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Log"), OutputType(typeof(PSEventData))] + [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ActivityLog"), OutputType(typeof(PSEventData))] public class GetAzureRmLogCommand : LogsCmdletBase { /// diff --git a/src/Monitor/Monitor/Az.Monitor.psd1 b/src/Monitor/Monitor/Az.Monitor.psd1 index c1040711a419..b86284b6d95e 100644 --- a/src/Monitor/Monitor/Az.Monitor.psd1 +++ b/src/Monitor/Monitor/Az.Monitor.psd1 @@ -75,7 +75,7 @@ FunctionsToExport = @() # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = 'Get-AzMetricDefinition', 'Get-AzMetric', 'Remove-AzLogProfile', - 'Get-AzLogProfile', 'Add-AzLogProfile', 'Get-AzLog', + 'Get-AzLogProfile', 'Add-AzLogProfile', 'Get-AzActivityLog', 'Set-AzDiagnosticSetting', 'Get-AzDiagnosticSetting', 'Remove-AzDiagnosticSetting', 'New-AzAutoscaleNotification', 'New-AzAutoscaleProfile', 'New-AzAutoscaleRule', diff --git a/src/Monitor/Monitor/ChangeLog.md b/src/Monitor/Monitor/ChangeLog.md index 77b94743608e..9c041f3d7d3b 100644 --- a/src/Monitor/Monitor/ChangeLog.md +++ b/src/Monitor/Monitor/ChangeLog.md @@ -29,6 +29,7 @@ - `Remove-AzInsightsPrivateLinkScopedResource` * Removed redundant definition for RetentionPolicy in PSLogProfile. Issue: https://github.com/Azure/azure-powershell/issues/7608 * Removed redundant properties difined in PSEventData. Issue: https://github.com/Azure/azure-powershell/issues/11353 +* Renamed `Get-AzLog` to `Get-AzActivityLog` ## Version 1.6.2 * Updated documentation for `New-AzScheduledQueryRuleLogMetricTrigger` diff --git a/src/Monitor/Monitor/help/Get-AzLog.md b/src/Monitor/Monitor/help/Get-AzActivityLog.md similarity index 68% rename from src/Monitor/Monitor/help/Get-AzLog.md rename to src/Monitor/Monitor/help/Get-AzActivityLog.md index 79edac14485a..022780cb0952 100644 --- a/src/Monitor/Monitor/help/Get-AzLog.md +++ b/src/Monitor/Monitor/help/Get-AzActivityLog.md @@ -1,12 +1,11 @@ --- external help file: Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll-Help.xml Module Name: Az.Monitor -ms.assetid: 85492E00-3776-4F20-A444-9C28CC6154B7 -online version: https://docs.microsoft.com/en-us/powershell/module/az.monitor/get-azlog +online version: https://docs.microsoft.com/en-us/powershell/module/az.monitor/get-azactivitylog schema: 2.0.0 --- -# Get-AzLog +# Get-AzActivityLog ## SYNOPSIS Retrieve Activity Log events. @@ -15,73 +14,74 @@ Retrieve Activity Log events. ### GetByCorrelationId ``` -Get-AzLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] [-DetailedOutput] - [-CorrelationId] [-MaxRecord ] [-DefaultProfile ] [] +Get-AzActivityLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] + [-DetailedOutput] [-CorrelationId] [-MaxRecord ] [-DefaultProfile ] + [] ``` ### GetByResourceId ``` -Get-AzLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] [-DetailedOutput] - [-ResourceId] [-MaxRecord ] [-DefaultProfile ] [] +Get-AzActivityLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] + [-DetailedOutput] [-ResourceId] [-MaxRecord ] [-DefaultProfile ] + [] ``` ### GetByResourceGroup ``` -Get-AzLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] [-DetailedOutput] - [-ResourceGroupName] [-MaxRecord ] [-DefaultProfile ] - [] +Get-AzActivityLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] + [-DetailedOutput] [-ResourceGroupName] [-MaxRecord ] + [-DefaultProfile ] [] ``` ### GetByResourceProvider ``` -Get-AzLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] [-DetailedOutput] - [-ResourceProvider] [-MaxRecord ] [-DefaultProfile ] +Get-AzActivityLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] + [-DetailedOutput] [-ResourceProvider] [-MaxRecord ] [-DefaultProfile ] [] ``` ### GetBySubscription ``` -Get-AzLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] [-DetailedOutput] - [-MaxRecord ] [-DefaultProfile ] [] +Get-AzActivityLog [-StartTime ] [-EndTime ] [-Status ] [-Caller ] + [-DetailedOutput] [-MaxRecord ] [-DefaultProfile ] [] ``` ## DESCRIPTION -The **Get-AzLog** cmdlet retrieve Activity Log events. -The events can be associated with the current subscription ID, correlation ID, resource group, resource ID, or resource provider. +The Get-AzActivityLog cmdlet retrieve Activity Log events. The events can be associated with the current subscription ID, correlation ID, resource group, resource ID, or resource provider. ## EXAMPLES ### Example 1: Get an event log by subscription ID ``` -PS C:\>Get-AzLog +PS C:\>Get-ActivityAzLog ``` This command lists at most 1000 events associated with the user's subscription ID that took place 7 days from the current date/time. ### Example 2: Get an event log by subscription ID with a maximum number of events ``` -PS C:\>Get-AzLog -MaxRecord 100 +PS C:\>Get-AzActivityLog -MaxRecord 100 ``` This command lists at most 100 events associated with the user's subscription ID that took place 7 days from the current date/time. ### Example 3: Get an event log by subscription ID with a start time. ``` -PS C:\>Get-AzLog -StartTime 2017-06-01T10:30 +PS C:\>Get-AzActivityLog -StartTime 2017-06-01T10:30 ``` This command lists at most 1000 events associated with the user's subscription ID that took place on or after 2017-06-01T10:30 local time if that date/time is not older than 90 days from the current date/time. ### Example 4: Get an event log by subscription ID with a start time and end time. ``` -PS C:\>Get-AzLog -StartTime 2017-04-01T10:30 -EndTime 2017-04-14T11:30 +PS C:\>Get-AzActivityLog -StartTime 2017-04-01T10:30 -EndTime 2017-04-14T11:30 ``` This command lists at most 1000 of the events associated with the user's subscription ID that took place on or after 2017-04-01T10:30 local time, and before 2017-04-14T11:30 local time if the whole date/time range is not older than 90 days from the current date/time, i.e.: the retention period. ### Example 5: Get an event log by correlation ID ``` -PS C:\>Get-AzLog -CorrelationId "60c694d0-e46f-4c12-bed1-9b7aef541c23" +PS C:\>Get-AzActivityLog -CorrelationId "60c694d0-e46f-4c12-bed1-9b7aef541c23" ``` This command lists at most 1000 events associated with the specified correlation ID that took place 7 days from the current date/time. @@ -89,7 +89,7 @@ This command lists at most 1000 events associated with the specified correlation ### Example 6: Get an event log by correlation ID with a maximum number of events ``` -PS C:\>Get-AzLog -CorrelationId "60c694d0-e46f-4c12-bed1-9b7aef541c23" -MaxRecord 100 +PS C:\>Get-AzActivityLog -CorrelationId "60c694d0-e46f-4c12-bed1-9b7aef541c23" -MaxRecord 100 ``` This command lists at most 100 events associated with the specified correlation ID that took place 7 days from the current date/time. @@ -97,7 +97,7 @@ This command lists at most 100 events associated with the specified correlation ### Example 7: Get an event log by correlation ID and start time ``` -PS C:\>Get-AzLog -CorrelationId "60c694d0-e46f-4c12-bed1-9b7aef541c23" -StartTime 2017-05-22T04:30:00 +PS C:\>Get-AzActivityLog -CorrelationId "60c694d0-e46f-4c12-bed1-9b7aef541c23" -StartTime 2017-05-22T04:30:00 ``` This command lists at most 1000 events associated with the specified correlation ID that took place on or after 2017-05-22T04:30:00 local time if the start time is not older than 90 days from the current date/time. @@ -105,91 +105,91 @@ This command lists at most 1000 events associated with the specified correlation ### Example 8: Get an event log by correlation ID with start time and end time ``` -PS C:\>Get-AzLog -CorrelationId "60c694d0-e46f-4c12-bed1-9b7aef541c23" -StartTime 2017-04-15T04:30:00 -EndTime 2017-04-25T12:30:00 +PS C:\>Get-AzActivityLog -CorrelationId "60c694d0-e46f-4c12-bed1-9b7aef541c23" -StartTime 2017-04-15T04:30:00 -EndTime 2017-04-25T12:30:00 ``` This command lists at most 1000 events associated with the specified correlation ID that took place on or after 2017-04-15T04:30 local time, but before 2017-04-25T12:30 local time if the whole date/time range is not older than 90 days from the current date/time, i.e.: the retention period. ### Example 9: Get an event log for a resource group ``` -PS C:\>Get-AzLog -ResourceGroupName "Contoso-Web-CentralUS" +PS C:\>Get-AzActivityLog -ResourceGroupName "Contoso-Web-CentralUS" ``` This command lists at most 1000 the events associated with the specified resource group that took place 7 days from the current date/time. ### Example 10: Get an event log for a resource group with a maximum number of events ``` -PS C:\>Get-AzLog -ResourceGroup "Contoso-Web-CentralUS" -MaxRecord 100 +PS C:\>Get-AzActivityLog -ResourceGroup "Contoso-Web-CentralUS" -MaxRecord 100 ``` This command lists at most 100 events associated with the specified resource group that took place 7 days from the current date/time. ### Example 11: Get an event log for a resource group by start time ``` -PS C:\>Get-AzLog -ResourceGroup "Contoso-Web-CentralUS" -StartTime 2017-05-22T04:30:00 +PS C:\>Get-AzActivityLog -ResourceGroup "Contoso-Web-CentralUS" -StartTime 2017-05-22T04:30:00 ``` This command lists at most 1000 events associated with the specified resource group that took place on or after 2017-05-22T04:30:00 local time if the start time is not older than 90 days from the current date/time. ### Example 12: Get an event log for a resource group with a start time and end time ``` -PS C:\>Get-AzLog -ResourceGroup "Contoso-Web-CentralUS" -StartTime 2017-04-15T04:30 -EndTime 2017-04-25T12:30 +PS C:\>Get-AzActivityLog -ResourceGroup "Contoso-Web-CentralUS" -StartTime 2017-04-15T04:30 -EndTime 2017-04-25T12:30 ``` This command lists at most 1000 events associated with the specified resource group that took place on or after 2017-04-15T04:30 local time, but before 2017-04-25T12:30 local time if the whole date/time range is not older than 90 days from the current date/time, i.e.: the retention period. ### Example 13: Get an event log by resource ID ``` -PS C:\>Get-AzLog -ResourceId "/subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/ResourceGroups/Contoso-Web-CentralUS/providers/Microsoft.Web/ServerFarms/Contoso1" +PS C:\>Get-AzActivityLog -ResourceId "/subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/ResourceGroups/Contoso-Web-CentralUS/providers/Microsoft.Web/ServerFarms/Contoso1" ``` This command lists at most 1000 events associated with the specified resource ID that took place 7 days from the current date/time. ### Example 14: Get an event log by resource ID with a maximum number of events ``` -PS C:\>Get-AzLog -ResourceId "/subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/ResourceGroups/Contoso-Web-CentralUS/providers/Microsoft.Web/ServerFarms/Contoso1" -MaxRecord 100 +PS C:\>Get-AzActivityLog -ResourceId "/subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/ResourceGroups/Contoso-Web-CentralUS/providers/Microsoft.Web/ServerFarms/Contoso1" -MaxRecord 100 ``` This command lists at most 100 events associated with the specified resource ID that took place 7 days from the current date/time. ### Example 15: Get an event log by resource ID with a start time ``` -PS C:\>Get-AzLog -ResourceId "/subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/ResourceGroups/Contoso-Web-CentralUS/providers/Microsoft.Web/ServerFarms/Contoso1" -StartTime 2017-05-22T04:30 +PS C:\>Get-AzActivityLog -ResourceId "/subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/ResourceGroups/Contoso-Web-CentralUS/providers/Microsoft.Web/ServerFarms/Contoso1" -StartTime 2017-05-22T04:30 ``` This command lists at most 1000 events associated with the specified resource ID that took place on or after 2017-05-22T04:30:00 local time if the start time is not older than 90 days from the current date/time. ### Example 16: Get an event log by resource ID with a start time and end time ``` -PS C:\>Get-AzLog -ResourceId "/subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/ResourceGroups/Contoso-Web-CentralUS/providers/Microsoft.Web/ServerFarms/Contoso1" -StartTime 2017-04-15T04:30 -EndTime 2017-04-25T12:30 +PS C:\>Get-AzActivityLog -ResourceId "/subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/ResourceGroups/Contoso-Web-CentralUS/providers/Microsoft.Web/ServerFarms/Contoso1" -StartTime 2017-04-15T04:30 -EndTime 2017-04-25T12:30 ``` This command lists at most 1000 events associated with the specified resource ID that took place on or after 2017-04-15T04:30 local time, but before 2017-04-25T12:30 local time if the whole date/time range is not older than 90 days from the current date/time, i.e.: the retention period. ### Example 17: Get an event log by resource provider ``` -PS C:\>Get-AzLog -ResourceProvider "Microsoft.Web" +PS C:\>Get-AzActivityLog -ResourceProvider "Microsoft.Web" ``` This command lists at most 1000 events associated with the specified resource provider that took place 7 days from the current date/time. ### Example 18: Get an event log by resource provider with a maximum number of events ``` -PS C:\>Get-AzLog -ResourceProvider "Microsoft.Web" -MaxRecord 100 +PS C:\>Get-AzActivityLog -ResourceProvider "Microsoft.Web" -MaxRecord 100 ``` This command lists at most 100 events associated with the specified resource provider that took place 7 days from the current date/time. ### Example 19: Get an event log by resource provider with a start time ``` -PS C:\>Get-AzLog -ResourceProvider "Microsoft.Web" -StartTime 2017-05-22T04:30 +PS C:\>Get-AzActivityLog -ResourceProvider "Microsoft.Web" -StartTime 2017-05-22T04:30 ``` This command lists at most 1000 events associated with the specified resource provider that took place on or after 2017-05-22T04:30:00 local time if the start time is not older than 90 days from the current date/time. ### Example 20: Get an event log by resource provider with a start time and end time ``` -PS C:\>Get-AzLog -ResourceProvider "Microsoft.Web" -StartTime 2017-04-15T04:30 -EndTime 2017-04-25T12:30 +PS C:\>Get-AzActivityLog -ResourceProvider "Microsoft.Web" -StartTime 2017-04-15T04:30 -EndTime 2017-04-25T12:30 ``` This command lists at most 1000 events associated with the specified resource provider that took place on or after 2017-04-15T04:30 local time, but before 2017-04-25T12:30 local time if the whole date/time range is not older than 90 days from the current date/time, i.e.: the retention period. @@ -197,7 +197,7 @@ This command lists at most 1000 events associated with the specified resource pr ## PARAMETERS ### -Caller -Specifies a caller. +The caller of the events to fetch ```yaml Type: System.String @@ -212,8 +212,7 @@ Accept wildcard characters: False ``` ### -CorrelationId -Specifies the correlation ID. -This parameter is required. +The CorrelationId ```yaml Type: System.String @@ -228,7 +227,7 @@ Accept wildcard characters: False ``` ### -DefaultProfile -The credentials, account, tenant, and subscription used for communication with azure +The credentials, account, tenant, and subscription used for communication with Azure. ```yaml Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer @@ -243,8 +242,8 @@ Accept wildcard characters: False ``` ### -DetailedOutput -Indicates that this cmdlet displays detailed output. -By default, output is summarized. +Return object with all the details of the events (the default is to return only some attributes, i.e. +no detail) ```yaml Type: System.Management.Automation.SwitchParameter @@ -253,16 +252,13 @@ Aliases: Required: False Position: Named -Default value: Switch not present = False, i.e. output summarized +Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -EndTime -Specifies the end time of the query in local time. -The default value is the current time. -The value must be later than *StartTime*. -You can use the Get-Date cmdlet to get a **DateTime** object. +The endTime of the query ```yaml Type: System.Nullable`1[System.DateTime] @@ -271,14 +267,14 @@ Aliases: Required: False Position: Named -Default value: Current date (time: 00:00:00 AM) + 1 day +Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -MaxRecord -Specifies the total number of records to fetch for the specified filter. -The default value is 1000 and the maximum value accepted is 100000. Negative values and 0 are ignored and the default value will be used. +The maximum number of records to fetch. +Alias: MaxRecords, MaxEvents ```yaml Type: System.Int32 @@ -287,13 +283,13 @@ Aliases: Required: False Position: Named -Default value: 1000 +Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -ResourceGroupName -Specifies the name of the resource group. +The resource group name ```yaml Type: System.String @@ -308,7 +304,7 @@ Accept wildcard characters: False ``` ### -ResourceId -Specifies the resource ID. +The ResourceId ```yaml Type: System.String @@ -323,7 +319,7 @@ Accept wildcard characters: False ``` ### -ResourceProvider -Specifies a filter by resource provider. +The ResourceProvider name ```yaml Type: System.String @@ -338,9 +334,7 @@ Accept wildcard characters: False ``` ### -StartTime -Specifies the start time of the query in local time. -The default value is *EndTime* minus seven days. -You can use the Get-Date cmdlet to get a **DateTime** object. +The correlationId of the query ```yaml Type: System.Nullable`1[System.DateTime] @@ -349,13 +343,13 @@ Aliases: Required: False Position: Named -Default value: EndTime - 7 days +Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -Status -Specifies the status. +The status of the events to fetch ```yaml Type: System.String From 62dd1c50dc01361b70308605cfdb119fe1359dad Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Mon, 20 Apr 2020 18:43:06 +0800 Subject: [PATCH 04/10] update az.monitor.md --- src/Monitor/Monitor/help/Az.Monitor.md | 27 +++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/Monitor/Monitor/help/Az.Monitor.md b/src/Monitor/Monitor/help/Az.Monitor.md index 9500ec695c7a..7eb82fd191d2 100644 --- a/src/Monitor/Monitor/help/Az.Monitor.md +++ b/src/Monitor/Monitor/help/Az.Monitor.md @@ -35,6 +35,9 @@ Enables an activity log alert and sets its Tags. ### [Get-AzActionGroup](Get-AzActionGroup.md) Gets action group(s). +### [Get-AzActivityLog](Get-AzActivityLog.md) +Retrieve Activity Log events. + ### [Get-AzActivityLogAlert](Get-AzActivityLogAlert.md) Gets one or more activity log alert resources. @@ -53,8 +56,11 @@ Gets Autoscale settings. ### [Get-AzDiagnosticSetting](Get-AzDiagnosticSetting.md) Gets the logged categories and time grains. -### [Get-AzLog](Get-AzLog.md) -Gets a log of events. +### [Get-AzInsightsPrivateLinkScope](Get-AzInsightsPrivateLinkScope.md) +Get private link scope + +### [Get-AzInsightsPrivateLinkScopedResource](Get-AzInsightsPrivateLinkScopedResource.md) +Get for private link scoped resource ### [Get-AzLogProfile](Get-AzLogProfile.md) Gets a log profile. @@ -98,6 +104,12 @@ Creates an Autoscale rule. ### [New-AzAutoscaleWebhook](New-AzAutoscaleWebhook.md) Creates an Autoscale webhook. +### [New-AzInsightsPrivateLinkScope](New-AzInsightsPrivateLinkScope.md) +create private link scope + +### [New-AzInsightsPrivateLinkScopedResource](New-AzInsightsPrivateLinkScopedResource.md) +create for private link scoped resource + ### [New-AzMetricAlertRuleV2Criteria](New-AzMetricAlertRuleV2Criteria.md) Creates a local criteria object that can be used to create a new metric alert @@ -117,7 +129,7 @@ Creates an object of type Alerting Action Creates an object of type Azns Action Group ### [New-AzScheduledQueryRuleLogMetricTrigger](New-AzScheduledQueryRuleLogMetricTrigger.md) -Creates an object of type Log Metric Trigger +Creates an object of type Log Metric Trigger. ### [New-AzScheduledQueryRuleSchedule](New-AzScheduledQueryRuleSchedule.md) Creates an object of type Schedule @@ -143,6 +155,12 @@ Removes an Autoscale setting. ### [Remove-AzDiagnosticSetting](Remove-AzDiagnosticSetting.md) Remove a diagnostic setting for the a resource. +### [Remove-AzInsightsPrivateLinkScope](Remove-AzInsightsPrivateLinkScope.md) +delete private link scope + +### [Remove-AzInsightsPrivateLinkScopedResource](Remove-AzInsightsPrivateLinkScopedResource.md) +delete for private link scoped resource + ### [Remove-AzLogProfile](Remove-AzLogProfile.md) Removes a log profile. @@ -164,6 +182,9 @@ Sets the logs and metrics settings for the resource. ### [Set-AzScheduledQueryRule](Set-AzScheduledQueryRule.md) Updates a Log Alert Rule +### [Update-AzInsightsPrivateLinkScope](Update-AzInsightsPrivateLinkScope.md) +Update for private link scope + ### [Update-AzScheduledQueryRule](Update-AzScheduledQueryRule.md) Updates a Log Alert rule From 09b6142dd7b32a433a82fc0bcd3cc96cbec82583 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Fri, 8 May 2020 16:43:20 +0800 Subject: [PATCH 05/10] merge change log from master --- src/Monitor/Monitor/ChangeLog.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Monitor/Monitor/ChangeLog.md b/src/Monitor/Monitor/ChangeLog.md index 1d8faa7f6067..9855a04296ea 100644 --- a/src/Monitor/Monitor/ChangeLog.md +++ b/src/Monitor/Monitor/ChangeLog.md @@ -23,6 +23,9 @@ * Support WebTest availability criteria for metric alert V2 - New-AzMetricAlertRuleV2Criteria: an option to create webtest availability criteria was added - Add-AzMetricAlertRuleV2: supports the new webtest availability criteria +* Removed redundant definition for RetentionPolicy in PSLogProfile. Issue: https://github.com/Azure/azure-powershell/issues/7608 +* Removed redundant properties difined in PSEventData. Issue: https://github.com/Azure/azure-powershell/issues/11353 +* Renamed `Get-AzLog` to `Get-AzActivityLog` ## Version 1.7.0 * Added cmdlets for private link scope @@ -33,9 +36,6 @@ - `Get-AzInsightsPrivateLinkScopedResource` - `New-AzInsightsPrivateLinkScopedResource` - `Remove-AzInsightsPrivateLinkScopedResource` -* Removed redundant definition for RetentionPolicy in PSLogProfile. Issue: https://github.com/Azure/azure-powershell/issues/7608 -* Removed redundant properties difined in PSEventData. Issue: https://github.com/Azure/azure-powershell/issues/11353 -* Renamed `Get-AzLog` to `Get-AzActivityLog` ## Version 1.6.2 * Updated documentation for `New-AzScheduledQueryRuleLogMetricTrigger` From 742ca194ba939cf5eb38e8269dc985ce0c38e7ba Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Fri, 8 May 2020 19:08:16 +0800 Subject: [PATCH 06/10] add alias for get-azactivitylog --- src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs b/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs index af98578e9f11..c89f2667124a 100644 --- a/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs +++ b/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs @@ -23,6 +23,7 @@ namespace Microsoft.Azure.Commands.Insights.Events /// /// Get the list of events for at a subscription level. /// + [Alias("Get-AzLog")] [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ActivityLog"), OutputType(typeof(PSEventData))] public class GetAzureRmLogCommand : LogsCmdletBase { From 8d7471600ddc92fad99e199dd4aa435ee557faf1 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Fri, 8 May 2020 19:09:11 +0800 Subject: [PATCH 07/10] export alias --- src/Monitor/Monitor/Az.Monitor.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Monitor/Monitor/Az.Monitor.psd1 b/src/Monitor/Monitor/Az.Monitor.psd1 index f3e8a0dd9e85..0f902b267c4f 100644 --- a/src/Monitor/Monitor/Az.Monitor.psd1 +++ b/src/Monitor/Monitor/Az.Monitor.psd1 @@ -113,7 +113,7 @@ CmdletsToExport = 'Get-AzMetricDefinition', 'Get-AzMetric', 'Remove-AzLogProfile # VariablesToExport = @() # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. -AliasesToExport = @() +AliasesToExport = @("Get-AzLog") # DSC resources to export from this module # DscResourcesToExport = @() From b37df180f72f056e8863abbd0509fa37149f2a68 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Fri, 8 May 2020 19:28:42 +0800 Subject: [PATCH 08/10] suppress breaking change issues --- .../Exceptions/Az.Monitor/BreakingChangeIssues.csv | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssues.csv index f691667ae7da..6d2ae33f1ae0 100644 --- a/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssues.csv +++ b/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssues.csv @@ -9,4 +9,6 @@ "Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Alerts.NewAzureRmMetricAlertRuleV2CriteriaCommand","New-AzMetricAlertRuleV2Criteria","0","3000","The type of property 'OperatorProperty' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricCriteria' has changed from 'System.Object' to 'System.String'.","Change the type of property 'OperatorProperty' back to 'System.Object'." "Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Alerts.NewAzureRmMetricAlertRuleV2CriteriaCommand","New-AzMetricAlertRuleV2Criteria","0","3000","The type of property 'OperatorProperty' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSDynamicMetricCriteria' has changed from 'System.Object' to 'System.String'.","Change the type of property 'OperatorProperty' back to 'System.Object'." "Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Alerts.NewAzureRmMetricAlertRuleV2CriteriaCommand","New-AzMetricAlertRuleV2Criteria","0","3000","The type of property 'AlertSensitivity' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSDynamicMetricCriteria' has changed from 'System.Object' to 'System.String'.","Change the type of property 'AlertSensitivity' back to 'System.Object'." -"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Alerts.NewAzureRmMetricAlertRuleV2CriteriaCommand","New-AzMetricAlertRuleV2Criteria","0","1050","The parameter set '__AllParameterSets' for cmdlet 'New-AzMetricAlertRuleV2Criteria' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'New-AzMetricAlertRuleV2Criteria'." \ No newline at end of file +"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Alerts.NewAzureRmMetricAlertRuleV2CriteriaCommand","New-AzMetricAlertRuleV2Criteria","0","1050","The parameter set '__AllParameterSets' for cmdlet 'New-AzMetricAlertRuleV2Criteria' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'New-AzMetricAlertRuleV2Criteria'." +"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.LogProfiles.AddAzureRmLogProfileCommand","Add-AzLogProfile","0","3000","The type of property 'RetentionPolicy' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile' has changed from 'Microsoft.Azure.Management.Monitor.Management.Models.RetentionPolicy' to 'Microsoft.Azure.Management.Monitor.Models.RetentionPolicy'.","Change the type of property 'RetentionPolicy' back to 'Microsoft.Azure.Management.Monitor.Management.Models.RetentionPolicy'." +"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.LogProfiles.GetAzureRmLogProfileCommand","Get-AzLogProfile","0","3000","The type of property 'RetentionPolicy' of type 'Microsoft.Azure.Commands.Insights.OutputClasses.PSLogProfile' has changed from 'Microsoft.Azure.Management.Monitor.Management.Models.RetentionPolicy' to 'Microsoft.Azure.Management.Monitor.Models.RetentionPolicy'.","Change the type of property 'RetentionPolicy' back to 'Microsoft.Azure.Management.Monitor.Management.Models.RetentionPolicy'." \ No newline at end of file From e5c3bc00fb060899cda39f378183491a8166b5b3 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Fri, 8 May 2020 20:10:22 +0800 Subject: [PATCH 09/10] add default parameter set for get-azactivitylog --- src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs b/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs index c89f2667124a..d27e175df5eb 100644 --- a/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs +++ b/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.Insights.Events /// Get the list of events for at a subscription level. /// [Alias("Get-AzLog")] - [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ActivityLog"), OutputType(typeof(PSEventData))] + [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ActivityLog", DefaultParameterSetName = ResourceGroupParameterSetName), OutputType(typeof(PSEventData))] public class GetAzureRmLogCommand : LogsCmdletBase { /// From 43e7ffb5d7b17c41d06a913e5e5de06dc398f7f2 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Sat, 9 May 2020 14:06:03 +0800 Subject: [PATCH 10/10] update default parameter set for get-azactivitylog --- src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs b/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs index d27e175df5eb..7c9d766a9560 100644 --- a/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs +++ b/src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.Insights.Events /// Get the list of events for at a subscription level. /// [Alias("Get-AzLog")] - [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ActivityLog", DefaultParameterSetName = ResourceGroupParameterSetName), OutputType(typeof(PSEventData))] + [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ActivityLog", DefaultParameterSetName = SubscriptionLevelParameterSetName), OutputType(typeof(PSEventData))] public class GetAzureRmLogCommand : LogsCmdletBase { ///