Skip to content
Merged
28 changes: 14 additions & 14 deletions src/Monitor/Monitor.Test/ScenarioTests/ActivityLogsTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
Expand All @@ -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
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Monitor/Monitor/ActivityLogs/GetAzureRmLogCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ namespace Microsoft.Azure.Commands.Insights.Events
/// <summary>
/// Get the list of events for at a subscription level.
/// </summary>
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Log"), OutputType(typeof(PSEventData))]
[Alias("Get-AzLog")]
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ActivityLog", DefaultParameterSetName = SubscriptionLevelParameterSetName), OutputType(typeof(PSEventData))]
public class GetAzureRmLogCommand : LogsCmdletBase
{
/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Monitor/Monitor/Az.Monitor.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 = @()
Expand Down
3 changes: 3 additions & 0 deletions src/Monitor/Monitor/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
* Supported 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 [#7608]
* Removed redundant properties difined in PSEventData [#11353]
* Renamed `Get-AzLog` to `Get-AzActivityLog`

## Version 1.7.0
* Added cmdlets for private link scope
Expand Down
5 changes: 0 additions & 5 deletions src/Monitor/Monitor/OutputClasses/PSLogProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ namespace Microsoft.Azure.Commands.Insights.OutputClasses
/// </summary>
public class PSLogProfile : LogProfileResource
{
/// <summary>
/// Gets or sets the RetentionPolicy of the LogProfile
/// </summary>
public new Management.Monitor.Management.Models.RetentionPolicy RetentionPolicy { get; set; }

/// <summary>
/// Initializes a new instance of the <see cref="PSLogProfile"/> class.
/// </summary>
Expand Down
27 changes: 24 additions & 3 deletions src/Monitor/Monitor/help/Az.Monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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.

Expand All @@ -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

Loading