diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj index 55394b43cbe4..54c727240195 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj @@ -150,11 +150,7 @@ - - - - - + diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureCorrelationIdLogCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureCorrelationIdLogCommandTests.cs deleted file mode 100644 index 194574b0d35c..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureCorrelationIdLogCommandTests.cs +++ /dev/null @@ -1,82 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Management.Automation; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Commands.Insights.Events; -using Microsoft.Azure.Insights; -using Microsoft.Azure.Insights.Models; -using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Moq; -using Xunit; - -namespace Microsoft.Azure.Commands.Insights.Test.Events -{ - public class GetAzureCorrelationIdLogCommandTests - { - private readonly GetAzureCorrelationIdLogCommand cmdlet; - private readonly Mock insightsClientMock; - private readonly Mock insightsEventOperationsMock; - private Mock commandRuntimeMock; - private EventDataListResponse response; - private string filter; - private string selected; - - public GetAzureCorrelationIdLogCommandTests() - { - insightsEventOperationsMock = new Mock(); - insightsClientMock = new Mock(); - commandRuntimeMock = new Mock(); - cmdlet = new GetAzureCorrelationIdLogCommand() - { - CommandRuntime = commandRuntimeMock.Object, - InsightsClient = insightsClientMock.Object - }; - - response = Utilities.InitializeResponse(); - - insightsEventOperationsMock.Setup(f => f.ListEventsAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(response)) - .Callback((string f, string s, CancellationToken t) => - { - filter = f; - selected = s; - }); - - insightsClientMock.SetupGet(f => f.EventOperations).Returns(this.insightsEventOperationsMock.Object); - } - - [Fact] - [Trait(Category.AcceptanceType, Category.CheckIn)] - public void GetAzureCorrelationIdLogCommandParametersProcessing() - { - var startDate = DateTime.Now.AddSeconds(-1); - - // Setting required parameter - cmdlet.CorrelationId = Utilities.Correlation; - - Utilities.ExecuteVerifications( - cmdlet: cmdlet, - insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, - requiredFieldName: "correlationId", - requiredFieldValue: Utilities.Correlation, - filter: ref this.filter, - selected: ref this.selected, - startDate: startDate, - response: response); - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureResourceGroupLogCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureResourceGroupLogCommandTests.cs deleted file mode 100644 index 65e3885e4462..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureResourceGroupLogCommandTests.cs +++ /dev/null @@ -1,82 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Management.Automation; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Commands.Insights.Events; -using Microsoft.Azure.Insights; -using Microsoft.Azure.Insights.Models; -using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Moq; -using Xunit; - -namespace Microsoft.Azure.Commands.Insights.Test.Events -{ - public class GetAzureResourceGroupLogCommandTests - { - private GetAzureResourceGroupLogCommand cmdlet; - private readonly Mock insightsClientMock; - private readonly Mock insightsEventOperationsMock; - private Mock commandRuntimeMock; - private EventDataListResponse response; - private string filter; - private string selected; - - public GetAzureResourceGroupLogCommandTests() - { - insightsEventOperationsMock = new Mock(); - insightsClientMock = new Mock(); - commandRuntimeMock = new Mock(); - cmdlet = new GetAzureResourceGroupLogCommand() - { - CommandRuntime = commandRuntimeMock.Object, - InsightsClient = insightsClientMock.Object - }; - - response = Utilities.InitializeResponse(); - - insightsEventOperationsMock.Setup(f => f.ListEventsAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(response)) - .Callback((string f, string s, CancellationToken t) => - { - filter = f; - selected = s; - }); - - insightsClientMock.SetupGet(f => f.EventOperations).Returns(this.insightsEventOperationsMock.Object); - } - - [Fact] - [Trait(Category.AcceptanceType, Category.CheckIn)] - public void GetAzureResourceGroupLogCommandParametersProcessing() - { - var startDate = DateTime.Now.AddSeconds(-1); - - // Setting required parameter - cmdlet.ResourceGroup = Utilities.ResourceGroup; - - Utilities.ExecuteVerifications( - cmdlet: cmdlet, - insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, - requiredFieldName: "resourceGroupName", - requiredFieldValue: Utilities.ResourceGroup, - filter: ref this.filter, - selected: ref this.selected, - startDate: startDate, - response: response); - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureResourceLogCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureResourceLogCommandTests.cs deleted file mode 100644 index 2535f8ce0615..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureResourceLogCommandTests.cs +++ /dev/null @@ -1,82 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Management.Automation; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Commands.Insights.Events; -using Microsoft.Azure.Insights; -using Microsoft.Azure.Insights.Models; -using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Moq; -using Xunit; - -namespace Microsoft.Azure.Commands.Insights.Test.Events -{ - public class GetAzureResourceLogCommandTests - { - private readonly GetAzureResourceLogCommand cmdlet; - private readonly Mock insightsClientMock; - private readonly Mock insightsEventOperationsMock; - private Mock commandRuntimeMock; - private EventDataListResponse response; - private string filter; - private string selected; - - public GetAzureResourceLogCommandTests() - { - insightsEventOperationsMock = new Mock(); - insightsClientMock = new Mock(); - commandRuntimeMock = new Mock(); - cmdlet = new GetAzureResourceLogCommand() - { - CommandRuntime = commandRuntimeMock.Object, - InsightsClient = insightsClientMock.Object - }; - - response = Utilities.InitializeResponse(); - - insightsEventOperationsMock.Setup(f => f.ListEventsAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(response)) - .Callback((string f, string s, CancellationToken t) => - { - filter = f; - selected = s; - }); - - insightsClientMock.SetupGet(f => f.EventOperations).Returns(this.insightsEventOperationsMock.Object); - } - - [Fact] - [Trait(Category.AcceptanceType, Category.CheckIn)] - public void GetAzureResourceLogCommandParametersProcessing() - { - var startDate = DateTime.Now.AddSeconds(-1); - - // Setting required parameter - cmdlet.ResourceId = Utilities.ResourceUri; - - Utilities.ExecuteVerifications( - cmdlet: cmdlet, - insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, - requiredFieldName: "resourceUri", - requiredFieldValue: Utilities.ResourceUri, - filter: ref this.filter, - selected: ref this.selected, - startDate: startDate, - response: response); - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureResourceProviderLogCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureResourceProviderLogCommandTests.cs deleted file mode 100644 index f8876a7baaa7..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureResourceProviderLogCommandTests.cs +++ /dev/null @@ -1,82 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Management.Automation; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Commands.Insights.Events; -using Microsoft.Azure.Insights; -using Microsoft.Azure.Insights.Models; -using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Moq; -using Xunit; - -namespace Microsoft.Azure.Commands.Insights.Test.Events -{ - public class GetAzureResourceProviderLogCommandTests - { - private readonly GetAzureResourceProviderLogCommand cmdlet; - private readonly Mock insightsClientMock; - private readonly Mock insightsEventOperationsMock; - private Mock commandRuntimeMock; - private EventDataListResponse response; - private string filter; - private string selected; - - public GetAzureResourceProviderLogCommandTests() - { - insightsEventOperationsMock = new Mock(); - insightsClientMock = new Mock(); - commandRuntimeMock = new Mock(); - cmdlet = new GetAzureResourceProviderLogCommand() - { - CommandRuntime = commandRuntimeMock.Object, - InsightsClient = insightsClientMock.Object - }; - - response = Utilities.InitializeResponse(); - - insightsEventOperationsMock.Setup(f => f.ListEventsAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(response)) - .Callback((string f, string s, CancellationToken t) => - { - filter = f; - selected = s; - }); - - insightsClientMock.SetupGet(f => f.EventOperations).Returns(this.insightsEventOperationsMock.Object); - } - - [Fact] - [Trait(Category.AcceptanceType, Category.CheckIn)] - public void GetAzureResourceProviderLogCommandParametersProcessing() - { - var startDate = DateTime.Now.AddSeconds(-1); - - // Setting required parameter - cmdlet.ResourceProvider = Utilities.ResourceProvider; - - Utilities.ExecuteVerifications( - cmdlet: cmdlet, - insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, - requiredFieldName: "resourceProvider", - requiredFieldValue: Utilities.ResourceProvider, - filter: ref this.filter, - selected: ref this.selected, - startDate: startDate, - response: response); - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureRmLogCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureRmLogCommandTests.cs new file mode 100644 index 000000000000..5d1145917183 --- /dev/null +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureRmLogCommandTests.cs @@ -0,0 +1,171 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Azure.Commands.Insights.Events; +using Microsoft.Azure.Insights; +using Microsoft.Azure.Insights.Models; +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Moq; +using Xunit; + +namespace Microsoft.Azure.Commands.Insights.Test.Events +{ + public class GetAzureRmLogCommandTests + { + private readonly GetAzureRmLogCommand cmdlet; + private readonly Mock insightsClientMock; + private readonly Mock insightsEventOperationsMock; + private Mock commandRuntimeMock; + private EventDataListResponse response; + private string filter; + private string selected; + + public GetAzureRmLogCommandTests() + { + insightsEventOperationsMock = new Mock(); + insightsClientMock = new Mock(); + commandRuntimeMock = new Mock(); + cmdlet = new GetAzureRmLogCommand() + { + CommandRuntime = commandRuntimeMock.Object, + InsightsClient = insightsClientMock.Object + }; + + response = Utilities.InitializeResponse(); + + insightsEventOperationsMock.Setup(f => f.ListEventsAsync(It.IsAny(), It.IsAny(), It.IsAny())) + .Returns(Task.FromResult(response)) + .Callback((string f, string s, CancellationToken t) => + { + filter = f; + selected = s; + }); + + insightsClientMock.SetupGet(f => f.EventOperations).Returns(this.insightsEventOperationsMock.Object); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void GetAzureSubscriptionIdLogCommandParametersProcessing() + { + var startDate = DateTime.Now.AddSeconds(-1); + + Utilities.ExecuteVerifications( + cmdlet: cmdlet, + insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, + requiredFieldName: null, + requiredFieldValue: null, + filter: ref this.filter, + selected: ref this.selected, + startDate: startDate, + response: response); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void GetAzureCorrelationIdLogCommandParametersProcessing() + { + var startDate = DateTime.Now.AddSeconds(-1); + + // Setting required parameter + cmdlet.CorrelationId = Utilities.Correlation; + cmdlet.ResourceId = null; + cmdlet.ResourceGroup = null; + cmdlet.ResourceProvider = null; + + Utilities.ExecuteVerifications( + cmdlet: cmdlet, + insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, + requiredFieldName: "correlationId", + requiredFieldValue: Utilities.Correlation, + filter: ref this.filter, + selected: ref this.selected, + startDate: startDate, + response: response); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void GetAzureResourceGroupLogCommandParametersProcessing() + { + var startDate = DateTime.Now.AddSeconds(-1); + + // Setting required parameter + cmdlet.ResourceGroup = Utilities.ResourceGroup; + cmdlet.CorrelationId = null; + cmdlet.ResourceId = null; + cmdlet.ResourceProvider = null; + + Utilities.ExecuteVerifications( + cmdlet: cmdlet, + insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, + requiredFieldName: "resourceGroupName", + requiredFieldValue: Utilities.ResourceGroup, + filter: ref this.filter, + selected: ref this.selected, + startDate: startDate, + response: response); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void GetAzureResourceLogCommandParametersProcessing() + { + var startDate = DateTime.Now.AddSeconds(-1); + + // Setting required parameter + cmdlet.ResourceId = Utilities.ResourceUri; + cmdlet.ResourceGroup = null; + cmdlet.CorrelationId = null; + cmdlet.ResourceProvider = null; + + Utilities.ExecuteVerifications( + cmdlet: cmdlet, + insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, + requiredFieldName: "resourceUri", + requiredFieldValue: Utilities.ResourceUri, + filter: ref this.filter, + selected: ref this.selected, + startDate: startDate, + response: response); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void GetAzureResourceProviderLogCommandParametersProcessing() + { + var startDate = DateTime.Now.AddSeconds(-1); + + // Setting required parameter + cmdlet.ResourceProvider = Utilities.ResourceProvider; + cmdlet.ResourceId = null; + cmdlet.ResourceGroup = null; + cmdlet.CorrelationId = null; + + Utilities.ExecuteVerifications( + cmdlet: cmdlet, + insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, + requiredFieldName: "resourceProvider", + requiredFieldValue: Utilities.ResourceProvider, + filter: ref this.filter, + selected: ref this.selected, + startDate: startDate, + response: response); + } + } +} diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureSubscriptionIdLogCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureSubscriptionIdLogCommandTests.cs deleted file mode 100644 index 3f17cf812a98..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Events/GetAzureSubscriptionIdLogCommandTests.cs +++ /dev/null @@ -1,79 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Management.Automation; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Commands.Insights.Events; -using Microsoft.Azure.Insights; -using Microsoft.Azure.Insights.Models; -using Microsoft.WindowsAzure.Commands.ScenarioTest; -using Moq; -using Xunit; - -namespace Microsoft.Azure.Commands.Insights.Test.Events -{ - public class GetAzureSubscriptionIdLogCommandTests - { - private readonly GetAzureSubscriptionIdLogCommand cmdlet; - private readonly Mock insightsClientMock; - private readonly Mock insightsEventOperationsMock; - private Mock commandRuntimeMock; - private EventDataListResponse response; - private string filter; - private string selected; - - public GetAzureSubscriptionIdLogCommandTests() - { - insightsEventOperationsMock = new Mock(); - insightsClientMock = new Mock(); - commandRuntimeMock = new Mock(); - cmdlet = new GetAzureSubscriptionIdLogCommand() - { - CommandRuntime = commandRuntimeMock.Object, - InsightsClient = insightsClientMock.Object - }; - - response = Utilities.InitializeResponse(); - - insightsEventOperationsMock.Setup(f => f.ListEventsAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(response)) - .Callback((string f, string s, CancellationToken t) => - { - filter = f; - selected = s; - }); - - insightsClientMock.SetupGet(f => f.EventOperations).Returns(this.insightsEventOperationsMock.Object); - } - - [Fact] - [Trait(Category.AcceptanceType, Category.CheckIn)] - public void GetAzureSubscriptionIdLogCommandParametersProcessing() - { - var startDate = DateTime.Now.AddSeconds(-1); - - Utilities.ExecuteVerifications( - cmdlet: cmdlet, - insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, - requiredFieldName: null, - requiredFieldValue: null, - filter: ref this.filter, - selected: ref this.selected, - startDate: startDate, - response: response); - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/EventsTests.ps1 b/src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/EventsTests.ps1 index 7f0d3ff7a4cd..66f3f6cc2580 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/EventsTests.ps1 +++ b/src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/EventsTests.ps1 @@ -24,7 +24,7 @@ function Test-GetAzureCorrelationIdLog try { # Test - $actual = Get-AzureRmCorrelationIdLog -CorrelationId $correlation -starttime 2015-03-02T10:00:00 -endtime 2015-03-02T12:00:00 -detailedOutput + $actual = Get-AzureRmLog -CorrelationId $correlation -starttime 2015-03-02T10:00:00 -endtime 2015-03-02T12:00:00 -detailedOutput # Assert TODO add more asserts Assert-AreEqual $actual.Count 2 @@ -47,7 +47,7 @@ function Test-GetAzureResourceGroupLog try { - $actual = Get-AzureRmResourceGroupLog -ResourceGroup $rgname -starttime 2015-01-15T04:30:00 -endtime 2015-01-15T12:30:00 + $actual = Get-AzureRmLog -ResourceGroup $rgname -starttime 2015-01-15T04:30:00 -endtime 2015-01-15T12:30:00 # Assert TODO add more asserts Assert-AreEqual $actual.Count 2 @@ -70,10 +70,10 @@ function Test-GetAzureResourceLog try { - $actual = Get-AzureRmResourceLog -ResourceId $rname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z + $actual = Get-AzureRmLog -ResourceId $rname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z # Assert TODO add more asserts - # Assert-Throws { Set-AzureRmResourceGroup -Name $rgname -Tags @{"testtag" = "testval"} } "Invalid tag format. Expect @{Name = `"tagName`"} or @{Name = `"tagName`"; Value = `"tagValue`"}" + # Assert-Throws { Set-AzureResourceGroup -Name $rgname -Tags @{"testtag" = "testval"} } "Invalid tag format. Expect @{Name = `"tagName`"} or @{Name = `"tagName`"; Value = `"tagValue`"}" Assert-AreEqual $actual.Count 2 } finally @@ -94,7 +94,7 @@ function Test-GetAzureResourceProviderLog try { - $actual = Get-AzureRmResourceProviderLog -ResourceProvider $rpname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z + $actual = Get-AzureRmLog -ResourceProvider $rpname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z # Assert Assert-AreEqual $actual.Count 2 @@ -117,7 +117,7 @@ function Test-GetAzureSubscriptionIdLog try { # Test - $actual = Get-AzureRmSubscriptionIdLog -starttime 2015-01-15T04:30:00 -endtime 2015-01-15T12:30:00 + $actual = Get-AzureRmLog -starttime 2015-01-15T04:30:00 -endtime 2015-01-15T12:30:00 # Assert Assert-AreEqual $actual.Count 1 diff --git a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj index e0dfa4174d18..adb162157d15 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj +++ b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj @@ -100,7 +100,7 @@ False - ..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll @@ -128,11 +128,7 @@ - - - - - + diff --git a/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs index 9d1c9a77a905..500b01f2107a 100644 --- a/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs @@ -31,7 +31,8 @@ public abstract class EventCmdletBase : InsightsClientCmdletBase { private static readonly TimeSpan MaximumDateDifferenceAllowedInDays = TimeSpan.FromDays(15); private static readonly TimeSpan DefaultQueryTimeRange = TimeSpan.FromHours(1); - private const int MaxNumberOfReturnedRecords = 100000; + private const int MaxNumberOfReturnedRecords = 1000; + private int MaxEvents = 0; internal const string SubscriptionLevelName = "Query at subscription level"; internal const string ResourceProviderName = "Query on ResourceProvider"; @@ -45,33 +46,33 @@ public abstract class EventCmdletBase : InsightsClientCmdletBase /// Gets or sets the starttime parameter of the cmdlet /// [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "The startTime of the query")] - public DateTime? StartTime { get; set; } + public virtual DateTime? StartTime { get; set; } /// /// Gets or sets the endtime parameter of the cmdlet /// [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "The endTime of the query")] - public DateTime? EndTime { get; set; } + public virtual DateTime? EndTime { get; set; } /// /// Gets or sets the status parameter of the cmdlet /// [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "The status of the records to fetch")] [ValidateNotNullOrEmpty] - public string Status { get; set; } + public virtual string Status { get; set; } /// /// Gets or sets the caller parameter of the cmdlet /// [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "The caller of the records to fetch")] [ValidateNotNullOrEmpty] - public string Caller { get; set; } + public virtual string Caller { get; set; } /// /// Gets or sets the detailedoutput parameter of the cmdlet /// [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "Return object with all the details of the records (the default is to return only some attributes, i.e. no detail)")] - public SwitchParameter DetailedOutput { get; set; } + public virtual SwitchParameter DetailedOutput { get; set; } #endregion @@ -98,6 +99,17 @@ protected virtual TimeSpan GetDefaultQueryTimeRange() return DefaultQueryTimeRange; } + /// + /// Sets the max number of records to fetch + /// + protected virtual void SetMaxEventsIfPresent(string currentQueryFilter, string name, int value) + { + if (value > 0 && value <= 100000) + { + this.MaxEvents = value; + } + } + /// /// Validates that the range of dates (start / end) makes sense, it is not to great (less 15 days), and adds the defaul values if needed /// @@ -192,6 +204,9 @@ protected override void ProcessRecordInternal() // Retrieve the records var fullDetails = this.DetailedOutput.IsPresent; + //Number of records to retrieve + int maxNumberOfRecords = this.MaxEvents > 0 ? this.MaxEvents : MaxNumberOfReturnedRecords; + // Call the proper API methods to return a list of raw records. In the future this pattern can be extended to include DigestRecords // If fullDetails is present do not select fields, if not present fetch only the SelectedFieldsForQuery EventDataListResponse response = this.InsightsClient.EventOperations.ListEventsAsync(filterString: queryFilter, selectedProperties: fullDetails ? null : PSEventDataNoDetails.SelectedFieldsForQuery, cancellationToken: CancellationToken.None).Result; @@ -199,15 +214,25 @@ protected override void ProcessRecordInternal() string nextLink = response.EventDataCollection.NextLink; // Adding a safety check to stop returning records if too many have been read already. - while (!string.IsNullOrWhiteSpace(nextLink) && records.Count < MaxNumberOfReturnedRecords) + while (!string.IsNullOrWhiteSpace(nextLink) && records.Count < maxNumberOfRecords) { response = this.InsightsClient.EventOperations.ListEventsNextAsync(nextLink: nextLink, cancellationToken: CancellationToken.None).Result; records.AddRange(response.EventDataCollection.Value.Select(e => fullDetails ? (IPSEventData)new PSEventData(e) : (IPSEventData)new PSEventDataNoDetails(e))); nextLink = response.EventDataCollection.NextLink; } + var recordsReturned = new List(); + if (records.Count > maxNumberOfRecords) + { + recordsReturned.AddRange(records.Take(maxNumberOfRecords)); + } + else + { + recordsReturned = records; + } + // Returns an object that contains a link to the set of subsequent records or null if not more records are available, called Next, and an array of records, called Value - WriteObject(sendToPipeline: records, enumerateCollection: true); + WriteObject(sendToPipeline: recordsReturned, enumerateCollection: true); } } } diff --git a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureCorrelationIdLogCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureCorrelationIdLogCommand.cs deleted file mode 100644 index 0bf3488e443a..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureCorrelationIdLogCommand.cs +++ /dev/null @@ -1,44 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Management.Automation; -using Microsoft.Azure.Commands.Insights.OutputClasses; - -namespace Microsoft.Azure.Commands.Insights.Events -{ - /// - /// Get the list of events for at a CorrelationId level. - /// - [Cmdlet(VerbsCommon.Get, "AzureRmCorrelationIdLog"), OutputType(typeof(List))] - public class GetAzureCorrelationIdLogCommand : EventCmdletBase - { - /// - /// Gets or sets the correlationId of the cmdlet - /// - [Parameter(Position = 0, ParameterSetName = CorrelationIdName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "CorrelationId")] - [ValidateNotNullOrEmpty] - public string CorrelationId { get; set; } - - /// - /// Process the parameters defined by this class (a.k.a. particular parameters) - /// - /// The current query filter - /// The query filter with the conditions for particular parameters added - protected override string ProcessParticularParameters(string currentQueryFilter) - { - return this.AddConditionIfPResent(currentQueryFilter, "correlationId", this.CorrelationId); - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureResourceGroupLogCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureResourceGroupLogCommand.cs deleted file mode 100644 index 196e2a9d819b..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureResourceGroupLogCommand.cs +++ /dev/null @@ -1,44 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Management.Automation; -using Microsoft.Azure.Commands.Insights.OutputClasses; - -namespace Microsoft.Azure.Commands.Insights.Events -{ - /// - /// Get the list of events for at a ResourceGroup level. - /// - [Cmdlet(VerbsCommon.Get, "AzureRmResourceGroupLog"), OutputType(typeof(List))] - public class GetAzureResourceGroupLogCommand : EventCmdletBase - { - /// - /// Gets or sets the resourcegroup parameters of this cmdlet - /// - [Parameter(Position = 0, ParameterSetName = ResourceGroupName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name")] - [ValidateNotNullOrEmpty] - public string ResourceGroup { get; set; } - - /// - /// Process the parameters defined by this class (a.k.a. particular parameters) - /// - /// The current query filter - /// The query filter with the conditions for particular parameters added - protected override string ProcessParticularParameters(string currentQueryFilter) - { - return this.AddConditionIfPResent(currentQueryFilter, "resourceGroupName", this.ResourceGroup); - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureResourceLogCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureResourceLogCommand.cs deleted file mode 100644 index 8b31401f7992..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureResourceLogCommand.cs +++ /dev/null @@ -1,46 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Management.Automation; -using Microsoft.Azure.Commands.Insights.OutputClasses; - -namespace Microsoft.Azure.Commands.Insights.Events -{ - /// - /// Get the list of events for at a Resource level. - /// - [Cmdlet(VerbsCommon.Get, "AzureRmResourceLog"), OutputType(typeof(List))] - public class GetAzureResourceLogCommand : EventCmdletBase - { - /// - /// Gets or sets the resourceId parameter of the cmdlet - /// - [Parameter(Position = 0, ParameterSetName = ResourceIdName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "ResourceId")] - [ValidateNotNullOrEmpty] - public string ResourceId { get; set; } - - /// - /// Process the parameters defined by this class (a.k.a. particular parameters) - /// - /// The current query filter - /// The query filter with the conditions for particular parameters added - protected override string ProcessParticularParameters(string currentQueryFilter) - { - // Notice the different name in the condition (resourceUri) and the parameter (resourceId) - // The difference is intentional as the new directive is to use ResourceId everywhere, but the SDK still uses resourceUri - return this.AddConditionIfPResent(currentQueryFilter, "resourceUri", this.ResourceId); - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureResourceProviderLogCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureResourceProviderLogCommand.cs deleted file mode 100644 index bd1d75740cf5..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureResourceProviderLogCommand.cs +++ /dev/null @@ -1,44 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Management.Automation; -using Microsoft.Azure.Commands.Insights.OutputClasses; - -namespace Microsoft.Azure.Commands.Insights.Events -{ - /// - /// Get the list of events for at a ResourceProvider level. - /// - [Cmdlet(VerbsCommon.Get, "AzureRmResourceProviderLog"), OutputType(typeof(List))] - public class GetAzureResourceProviderLogCommand : EventCmdletBase - { - /// - /// Gets or sets the resourceprovider parameter of the cmdlet - /// - [Parameter(Position = 0, ParameterSetName = ResourceProviderName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "ResourceProvider name")] - [ValidateNotNullOrEmpty] - public string ResourceProvider { get; set; } - - /// - /// Process the parameters defined by this class (a.k.a. particular parameters) - /// - /// The current query filter - /// The query filter with the conditions for particular parameters added - protected override string ProcessParticularParameters(string currentQueryFilter) - { - return this.AddConditionIfPResent(currentQueryFilter, "resourceProvider", this.ResourceProvider); - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureRmLogCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureRmLogCommand.cs new file mode 100644 index 000000000000..c943e41900b5 --- /dev/null +++ b/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureRmLogCommand.cs @@ -0,0 +1,117 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Management.Automation; +using Microsoft.Azure.Commands.Insights.OutputClasses; + +namespace Microsoft.Azure.Commands.Insights.Events +{ + /// + /// Get the list of events for at a subscription level. + /// + [Cmdlet(VerbsCommon.Get, "AzureRmLog"), OutputType(typeof(List))] + public class GetAzureRmLogCommand : EventCmdletBase + { + /// + /// Gets or sets the starttime parameter of the cmdlet + /// + [Parameter(ParameterSetName = CorrelationIdName, ValueFromPipelineByPropertyName = true, HelpMessage = "The correlationId of the query")] + [Parameter(ParameterSetName = ResourceIdName, ValueFromPipelineByPropertyName = true, HelpMessage = "The resourceId of the query")] + [Parameter(ParameterSetName = ResourceGroupName, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name of the query")] + [Parameter(ParameterSetName = ResourceProviderName, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource provider name of the query")] + [Parameter(ParameterSetName = SubscriptionLevelName, ValueFromPipelineByPropertyName = true, HelpMessage = "The subscriptionId of the query")] + public override DateTime? StartTime { get; set; } + + /// + /// Gets or sets the endtime parameter of the cmdlet + /// + [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "The endTime of the query")] + public override DateTime? EndTime { get; set; } + + /// + /// Gets or sets the status parameter of the cmdlet + /// + [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "The status of the events to fetch")] + [ValidateNotNullOrEmpty] + public override string Status { get; set; } + + /// + /// Gets or sets the caller parameter of the cmdlet + /// + [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "The caller of the events to fetch")] + [ValidateNotNullOrEmpty] + public override string Caller { get; set; } + + /// + /// Gets or sets the detailedoutput parameter of the cmdlet + /// + [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "Return object with all the details of the events (the default is to return only some attributes, i.e. no detail)")] + public override SwitchParameter DetailedOutput { get; set; } + + /// + /// Gets or sets the correlationId of the cmdlet + /// + [Parameter(Position = 0, ParameterSetName = CorrelationIdName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The CorrelationId")] + [ValidateNotNullOrEmpty] + public string CorrelationId { get; set; } + + /// + /// Gets or sets the resourcegroup parameters of this cmdlet + /// + [Parameter(Position = 0, ParameterSetName = ResourceGroupName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name")] + [ValidateNotNullOrEmpty] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the resourceId parameter of the cmdlet + /// + [Parameter(Position = 0, ParameterSetName = ResourceIdName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The ResourceId")] + [ValidateNotNullOrEmpty] + public string ResourceId { get; set; } + + /// + /// Gets or sets the resourceprovider parameter of the cmdlet + /// + [Parameter(Position = 0, ParameterSetName = ResourceProviderName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The ResourceProvider name")] + [ValidateNotNullOrEmpty] + public string ResourceProvider { get; set; } + + /// + /// Gets or sets the max number of events to fetch parameter of the cmdlet + /// + [Parameter(ValueFromPipelineByPropertyName = true, HelpMessage = "The maximum number of events to fetch")] + [ValidateNotNullOrEmpty] + public virtual int MaxEvents { get; set; } + + /// + /// Process the parameters defined by this class (a.k.a. particular parameters) + /// + /// The current query filter + /// The query filter with the conditions for particular parameters added + protected override string ProcessParticularParameters(string currentQueryFilter) + { + this.SetMaxEventsIfPresent(currentQueryFilter, "MaxEvents", this.MaxEvents); + + string extendedQuery = this.AddConditionIfPResent(currentQueryFilter, "correlationId", this.CorrelationId); + extendedQuery = this.AddConditionIfPResent(extendedQuery, "resourceGroupName", this.ResourceGroup); + + // Notice the different name in the condition (resourceUri) and the parameter (resourceId) + // The difference is intentional as the new directive is to use ResourceId everywhere, but the SDK still uses resourceUri + extendedQuery = this.AddConditionIfPResent(extendedQuery, "resourceUri", this.ResourceId); + return this.AddConditionIfPResent(extendedQuery, "resourceProvider", this.ResourceProvider); + } + } +} diff --git a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureSubscriptionIdLogCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureSubscriptionIdLogCommand.cs deleted file mode 100644 index b6a13fd20337..000000000000 --- a/src/ResourceManager/Insights/Commands.Insights/Events/GetAzureSubscriptionIdLogCommand.cs +++ /dev/null @@ -1,37 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Management.Automation; -using Microsoft.Azure.Commands.Insights.OutputClasses; - -namespace Microsoft.Azure.Commands.Insights.Events -{ - /// - /// Get the list of events for at a subscription level. - /// - [Cmdlet(VerbsCommon.Get, "AzureRmSubscriptionIdLog"), OutputType(typeof(List))] - public class GetAzureSubscriptionIdLogCommand : EventCmdletBase - { - /// - /// Process the parameters defined by this class (a.k.a. particular parameters) - /// - /// The current query filter - /// The query filter with the conditions for particular parameters added - protected override string ProcessParticularParameters(string currentQueryFilter) - { - return currentQueryFilter; - } - } -} diff --git a/src/ResourceManager/Insights/Commands.Insights/Microsoft.Azure.Commands.Insights.dll-Help.xml b/src/ResourceManager/Insights/Commands.Insights/Microsoft.Azure.Commands.Insights.dll-Help.xml index dbf0ac4236ce..9ad31cd23e78 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Microsoft.Azure.Commands.Insights.dll-Help.xml +++ b/src/ResourceManager/Insights/Commands.Insights/Microsoft.Azure.Commands.Insights.dll-Help.xml @@ -124,6 +124,20 @@ AzureProfile + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + Add-AlertRule @@ -274,6 +288,20 @@ AzureProfile + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + Add-AlertRule @@ -354,6 +382,20 @@ AzureProfile + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + @@ -537,6 +579,30 @@ + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + EventName @@ -1053,225 +1119,199 @@ add-autoscalesetting -Location "East US" -Name MySetting -ResourceGrou Get-AutoscaleHistory - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - Format-MetricsAsTable + Add-EventAlertRule - Formats the output of the Get-Metrics Cmdlet as an array of records, one for each metric value to be used by the Export-csv Cdmlet. + Adds or replaces an event alert rule - Format - MetricsAsTable + Add + EventAlertRule - Formats the output of the Get-Metrics Cmdlet as an array of records, one for each metric value. -The output of this Cmdlet is suitable to be processed by the Export-csv Cmdlet. + Adds or replaces an event alert rule. The added rule is associated to a resource group and has a name. - Format-MetricsAsTable - - Metrics + Add-EventAlertRule + + Operator - An array of Metric objects. This is usually the output of the Get-Metrics Cmdlet. + The relational operator for the condition of the rule. - Metric[] + ConditionOperator - - Profile + + Threshold - In-memory profile (AzureProfile). + The threshold of the rule. - AzureProfile + Double - - - - - Metrics - - An array of Metric objects. This is usually the output of the Get-Metrics Cmdlet. - - Metric[] - - Metric[] - - - - - - Profile - - In-memory profile (AzureProfile). - - AzureProfile - - AzureProfile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -------------------------- Example 1: Typical use to export to Excel -------------------------- - - PS C:\> - - $s = get-metrics -res /subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/garyyang1 -time 00:01:00 -det -$s2 = format-metricsastable $s -foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInformation} - - Export the output of Get-Metrics to a csv file that is readable by Excel. - - - "Name","TimestampUTC","Count","Last","Maximum","Minimum","Total","Average","StartTimeUTC","EndTimeUTC","TimeGrain","Unit","DimensionName","DimensionValue","ResourceId" -"AverageResponseTime","2015-03-20 16:15:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website1" -"AverageResponseTime","2015-03-20 16:17:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website1" -"AverageResponseTime","2015-03-20 16:18:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website1" - - - - - - - - - - - - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - - Get-Metrics - - - - - - - - - - - - Get-AlertHistory - - Retrieves the history of alerts. - - - - - Get - AlertHistory - - - - Retrieves the history of alerts as they get enabled, disabled, fire, resolve, etc. - - - - Get-AlertHistory ResourceId - The resource id the rule is associated to. + The id of the resource the rules is monitoring. String - - StartTime + + EventName - Specifies the start time of the query in local time. This parameter is optional. The default is the current local time minus one hour. + The name of the event the rule is monitoring. This is used only in the event-based rules. - Nullable`1[DateTime] + String - - EndTime + + Category - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. + The event category for the rule. - Nullable`1[DateTime] + String + + + Level + + The level of the event the rule is monitoring. This is used only in the event-based rules. + + String + + + OperationName + + The operation name + + String + + + ResourceProvider + + The resource provider + + String Status - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) + The status String - Caller + SubStatus - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) + The substatus String - DetailedOutput + EmailAddress - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + The e-mail address to include in the claims of the event. - SwitchParameter + String - - Profile + + Location - In-memory profile (AzureProfile). + The location where the rule is to be defined. - AzureProfile + String - - - - + + Description + + The description of the rule. + + String + + + DisableRule + + If present disables the rule. If absent the rule is enabled. + + SwitchParameter + + + ResourceGroup + + The resource group (name) of the rule + + String + + + Name + + Name of the rule + + String + + + WindowSize + + The time window size for the rule to compute its data. + + TimeSpan + + + SendToServiceOwners + + If present instructs the rule to send a notification to the service owners when the rule fires. + + SwitchParameter + + + CustomEmails + + A comma-separated list of e-mail addresses to use when notifying customers about a the rule firing. + + String[] + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + + + + + Operator + + The relational operator for the condition of the rule. + + ConditionOperator + + ConditionOperator + + + + + + Threshold + + The threshold of the rule. + + Double + + Double + + + + + ResourceId - The resource id the rule is associated to. + The id of the resource the rules is monitoring. String @@ -1280,26 +1320,62 @@ foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInf - - StartTime + + EventName - Specifies the start time of the query in local time. This parameter is optional. The default is the current local time minus one hour. + The name of the event the rule is monitoring. This is used only in the event-based rules. - Nullable`1[DateTime] + String - Nullable`1[DateTime] + String - - EndTime + + Category - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. + The event category for the rule. - Nullable`1[DateTime] + String - Nullable`1[DateTime] + String + + + + + + Level + + The level of the event the rule is monitoring. This is used only in the event-based rules. + + String + + String + + + + + + OperationName + + The operation name + + String + + String + + + + + + ResourceProvider + + The resource provider + + String + + String @@ -1307,7 +1383,7 @@ foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInf Status - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) + The status String @@ -1317,9 +1393,9 @@ foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInf - Caller + SubStatus - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) + The substatus String @@ -1329,9 +1405,93 @@ foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInf - DetailedOutput + EmailAddress - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + The e-mail address to include in the claims of the event. + + String + + String + + + + + + Location + + The location where the rule is to be defined. + + String + + String + + + + + + Description + + The description of the rule. + + String + + String + + + + + + DisableRule + + If present disables the rule. If absent the rule is enabled. + + SwitchParameter + + SwitchParameter + + + + + + ResourceGroup + + The resource group (name) of the rule + + String + + String + + + + + + Name + + Name of the rule + + String + + String + + + + + + WindowSize + + The time window size for the rule to compute its data. + + TimeSpan + + TimeSpan + + + + + + SendToServiceOwners + + If present instructs the rule to send a notification to the service owners when the rule fires. SwitchParameter @@ -1340,6 +1500,18 @@ foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInf + + CustomEmails + + A comma-separated list of e-mail addresses to use when notifying customers about a the rule firing. + + String[] + + String[] + + + + Profile @@ -1352,6 +1524,18 @@ foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInf + + EventSource + + The source of the event the rule is monitoring. This is used only in the event-based rules. + + string + + string + + + + @@ -1388,156 +1572,364 @@ foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInf - - -------------------------- Example 1: GetAlertHistory -------------------------- - - PS C:\> - - get-alerthistory -start 2015-02-11T11:00:00 -end 2015-02-11T12:00:00 -det - - This command retrieves all the alert rule-related events associated to the current subscription - - - Authorization : -Caller : Microsoft.Insights/alertRules -Claims : - http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules -CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2 -Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' has been resolved for Website: - garyyang1 (Default-Web-EastUS) -EventChannels : Admin, Operation -EventDataId : 769fab1c-fc9f-4e18-bc3a-fa79fbdd3616 -EventName : Alert -EventSource : microsoft.insights/alertrules -EventTimestamp : 2/11/2015 7:14:45 PM -HttpRequest : -Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/769fab1c-fc - 9f-4e18-bc3a-fa79fbdd3616/ticks/635592788857929926 -Level : Informational -OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2 -OperationName : ResolveAlert -Properties : - RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- - EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleDescription: - Threshold : 3 - WindowSizeInMinutes: 5 - Aggregation : Total - Operator : GreaterThan - MetricName : CpuTime - MetricUnit : Count -ResourceGroupName : Default-Web-EastUS -ResourceProviderName : microsoft.insights -ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d -Status : Resolved -SubmissionTimestamp : 2/11/2015 7:14:45 PM -SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f -SubStatus : - -Authorization : -Caller : Microsoft.Insights/alertRules -Claims : - http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules -CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 -Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' was activated for Website: garyyang1 - (Default-Web-EastUS) -EventChannels : Admin, Operation -EventDataId : 66277c94-2097-4f5f-860d-e585f1206cd7 -EventName : Alert -EventSource : microsoft.insights/alertrules -EventTimestamp : 2/11/2015 7:04:46 PM -HttpRequest : -Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.web/sites/garyyang1/events/66277c94-2097-4f5f-860d-e585f1206cd7/ticks/6355927828650595 - 14 -Level : Error -OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 -OperationName : ActivateAlert -Properties : - RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- - EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleDescription: - Threshold : 3 - WindowSizeInMinutes: 5 - Aggregation : Total - Operator : GreaterThan - MetricName : CpuTime - MetricUnit : Count -ResourceGroupName : Default-Web-EastUS -ResourceProviderName : microsoft.web -ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.web/sites/garyyang1 -Status : Activated -SubmissionTimestamp : 2/11/2015 7:04:46 PM -SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f -SubStatus : - -Authorization : -Caller : Microsoft.Insights/alertRules -Claims : - http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules -CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 -Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' was activated for Website: garyyang1 - (Default-Web-EastUS) -EventChannels : Admin, Operation -EventDataId : ec9f7b3c-c6ea-4b45-bd15-ff43e38491e3 -EventName : Alert -EventSource : microsoft.insights/alertrules -EventTimestamp : 2/11/2015 7:04:46 PM -HttpRequest : -Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/ec9f7b3c-c6 - ea-4b45-bd15-ff43e38491e3/ticks/635592782865059514 -Level : Error -OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 -OperationName : ActivateAlert -Properties : - RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- - EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleDescription: - Threshold : 3 - WindowSizeInMinutes: 5 - Aggregation : Total - Operator : GreaterThan - MetricName : CpuTime - MetricUnit : Count -ResourceGroupName : Default-Web-EastUS -ResourceProviderName : microsoft.insights -ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d -Status : Activated -SubmissionTimestamp : 2/11/2015 7:04:46 PM -SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f -SubStatus : + + + + Add-MetricAlertRule + + + + Add-WebtestAlertRule + + + + Get-AlertHistory + + + + Get-AlertRule + + + + + + + + Add-MetricAlertRule + + Adds or updates a metric-based alert rule. + + + + + Add + MetricAlertRule + + + + Adds or updates a metric-based alert rule. The added rule is associated to a resource group and has a name. + + + + Add-MetricAlertRule + + Operator + + The relational operator for the condition of the rule. + + ConditionOperator + + + Threshold + + The threshold of the rule. + + Double + + + ResourceId + + The id of the resource the rules is monitoring. + + String + + + MetricName + + The metric (name) the rule is monitoring. This is only used in metric-based rules. + + String + + + TimeAggregationOperator + + The aggregation operator to apply to the time window when the rule is being evaluated. + + Nullable`1[TimeAggregationOperator] + + + Location + + The location where the rule is to be defined. + + String + + + Description + + The description of the rule. + + String + + + DisableRule + + If present disables the rule. If absent the rule is enabled. + + SwitchParameter + + + ResourceGroup + + The resource group (name) of the rule. + + String + + + Name + + Name of the rule. + + String + + + WindowSize + + The time window size for the rule to compute its data. + + TimeSpan + + + SendToServiceOwners + + If present instructs the rule to send a notification to the service owners when the rule fires. + + SwitchParameter + + + CustomEmails + + A comma-separated list of e-mail addresses to use when notifying customers about a the rule firing. + + String[] + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + + + + + Operator + + The relational operator for the condition of the rule. + + ConditionOperator + + ConditionOperator + + + + + + Threshold + + The threshold of the rule. + + Double + + Double + + + + + + ResourceId + + The id of the resource the rules is monitoring. + + String + + String + + + + + + MetricName + + The metric (name) the rule is monitoring. This is only used in metric-based rules. + + String + + String + + + + + + TimeAggregationOperator + + The aggregation operator to apply to the time window when the rule is being evaluated. + + Nullable`1[TimeAggregationOperator] + + Nullable`1[TimeAggregationOperator] + + + + + + Location + + The location where the rule is to be defined. + + String + + String + + + + + + Description + + The description of the rule. + + String + + String + + + + + + DisableRule + + If present disables the rule. If absent the rule is enabled. + + SwitchParameter + + SwitchParameter + + + + + + ResourceGroup + + The resource group (name) of the rule. + + String + + String + + + + + + Name + + Name of the rule. + + String + + String + + + + + + WindowSize + + The time window size for the rule to compute its data. + + TimeSpan + + TimeSpan + + + + + + SendToServiceOwners + + If present instructs the rule to send a notification to the service owners when the rule fires. + + SwitchParameter + + SwitchParameter + + + + + + CustomEmails + + A comma-separated list of e-mail addresses to use when notifying customers about a the rule firing. + + String[] + + String[] + + + + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + AzureProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1: AddAlertRule (Metric) -------------------------- + + PS C:\> + + add-metricalertrule -Name chiricutin -Location "East US" -ResourceGroup Default-Web-EastUS -Operator GreaterThan -Threshold 2 -WindowSize 00:05:00 -ResourceId /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite -MetricName Requests -Description "Pura Vida" -TimeAggre Total + + This command creates a metric alert rule attached to a website + + + RequestId StatusCode +--------- ---------- +33574ccf-0b01-43b4-aa97-87e6bbcf1c11 Created @@ -1548,108 +1940,454 @@ SubStatus : - -------------------------- Example 2: GetAlertHistory for particular resource -------------------------- + -------------------------- Example 2: AddAlertRule disabling a rule -------------------------- PS C:\> - Get-alerthistory -start 2015-02-11T11:00:00 -end 2015-02-11T12:00:00 -res /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d -det + add-metricalertrule -Name chiricutin5 -Location "East US" -ResourceGroup Default-Web-EastUS -Operator GreaterThan -Threshold 2 -WindowSize 00:05:00 -ResourceId /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite -MetricName Requests -TimeAggre Total -CustomE gu@macrosoft.com -send -disab - This command retrieves the alert rule-related events associated to the particular resource identified by its resource id (a.k.a. ResourceUri) + This command disables a rule. +If the rule does not exist, it creates it disabled. +If the rule exists, then it just disables it. - Authorization : -Caller : Microsoft.Insights/alertRules -Claims : - http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules -CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2 -Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' has been resolved for Website: - garyyang1 (Default-Web-EastUS) -EventChannels : Admin, Operation -EventDataId : 769fab1c-fc9f-4e18-bc3a-fa79fbdd3616 -EventName : Alert -EventSource : microsoft.insights/alertrules -EventTimestamp : 2/11/2015 7:14:45 PM -HttpRequest : -Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/769fab1c-fc - 9f-4e18-bc3a-fa79fbdd3616/ticks/635592788857929926 -Level : Informational -OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2 -OperationName : ResolveAlert -Properties : - RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- - EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleDescription: - Threshold : 3 - WindowSizeInMinutes: 5 - Aggregation : Total - Operator : GreaterThan - MetricName : CpuTime - MetricUnit : Count -ResourceGroupName : Default-Web-EastUS -ResourceProviderName : microsoft.insights -ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d -Status : Resolved -SubmissionTimestamp : 2/11/2015 7:14:45 PM -SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f -SubStatus : - -Authorization : -Caller : Microsoft.Insights/alertRules -Claims : - http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules -CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 -Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' was activated for Website: garyyang1 - (Default-Web-EastUS) -EventChannels : Admin, Operation -EventDataId : ec9f7b3c-c6ea-4b45-bd15-ff43e38491e3 -EventName : Alert -EventSource : microsoft.insights/alertrules -EventTimestamp : 2/11/2015 7:04:46 PM -HttpRequest : -Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/ec9f7b3c-c6 - ea-4b45-bd15-ff43e38491e3/ticks/635592782865059514 -Level : Error -OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj - cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi - LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj - LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 -OperationName : ActivateAlert -Properties : - RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- - EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d - RuleDescription: - Threshold : 3 - WindowSizeInMinutes: 5 - Aggregation : Total - Operator : GreaterThan - MetricName : CpuTime - MetricUnit : Count -ResourceGroupName : Default-Web-EastUS -ResourceProviderName : microsoft.insights -ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d -Status : Activated -SubmissionTimestamp : 2/11/2015 7:04:46 PM -SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f -SubStatus : + RequestId StatusCode +--------- ---------- +96c489f1-8529-46e1-a76d-2c1463ca3116 OK + + + + + + + + + + + -------------------------- Example 3: AddAlertRule (Metric) with some actions -------------------------- + + PS C:\> + + add-metricalertrule -Name chiricutin5 -Location "East US" -ResourceGroup Default-Web-EastUS -Operator GreaterThan -Threshold 1 -ResourceId /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite -MetricName Requests -TimeAggre Total -CustomE gu@macrosoft.com,h@dd.com + + This command creates a metric alert rule attached to a website and with some e-mails to send notifications to. + + + RequestId StatusCode +--------- ---------- +9a5bc388-c7ac-4dc6-aa70-f4bc29c2c712 OK + + + + + + + + + + + + + Add-EventAlertRule + + + + Add-WebtestAlertRule + + + + Get-AlertHistory + + + + Get-AlertRule + + + + + + + + Add-WebtestAlertRule + + Adds or updates a webtest alert rule + + + + + Add + WebtestAlertRule + + + + Adds or updates an alert rule of either metric, event, or webtest type. The added rule is associated to a resource group and has a name. + + + + Add-WebtestAlertRule + + FailedLocationCount + + The failed location count for the webtest rules. This is similar to the threshold in the other types of rules. + + Int32 + + + Location + + The location where the rule is to be defined. + + String + + + Description + + The description of the rule. + + String + + + DisableRule + + If present disables the rule. If absent the rule is enabled. + + SwitchParameter + + + ResourceGroup + + The resource group (name) of the rule + + String + + + Name + + Name of the rule + + String + + + WindowSize + + The time window size for the rule to compute its data. + + TimeSpan + + + SendToServiceOwners + + If present instructs the rule to send a notification to the service owners when the rule fires. + + SwitchParameter + + + CustomEmails + + A comma-separated list of e-mail addresses to use when notifying customers about a the rule firing. + + String[] + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + + + + + FailedLocationCount + + The failed location count for the webtest rules. This is similar to the threshold in the other types of rules. + + Int32 + + Int32 + + + + + + Location + + The location where the rule is to be defined. + + String + + String + + + + + + Description + + The description of the rule. + + String + + String + + + + + + DisableRule + + If present disables the rule. If absent the rule is enabled. + + SwitchParameter + + SwitchParameter + + + + + + ResourceGroup + + The resource group (name) of the rule + + String + + String + + + + + + Name + + Name of the rule + + String + + String + + + + + + WindowSize + + The time window size for the rule to compute its data. + + TimeSpan + + TimeSpan + + + + + + SendToServiceOwners + + If present instructs the rule to send a notification to the service owners when the rule fires. + + SwitchParameter + + SwitchParameter + + + + + + CustomEmails + + A comma-separated list of e-mail addresses to use when notifying customers about a the rule firing. + + String[] + + String[] + + + + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + AzureProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Add-EventAlertRule + + + + Add-MetricAlertRule + + + + Get-AlertHistory + + + + Get-AlertRule + + + + + + + + Format-MetricsAsTable + + Formats the output of the Get-Metrics Cmdlet as an array of records, one for each metric value to be used by the Export-csv Cdmlet. + + + + + Format + MetricsAsTable + + + + Formats the output of the Get-Metrics Cmdlet as an array of records, one for each metric value. +The output of this Cmdlet is suitable to be processed by the Export-csv Cmdlet. + + + + Format-MetricsAsTable + + Metrics + + An array of Metric objects. This is usually the output of the Get-Metrics Cmdlet. + + Metric[] + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + + + + + Metrics + + An array of Metric objects. This is usually the output of the Get-Metrics Cmdlet. + + Metric[] + + Metric[] + + + + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + AzureProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1: Typical use to export to Excel -------------------------- + + PS C:\> + + $s = get-metrics -res /subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/garyyang1 -time 00:01:00 -det +$s2 = format-metricsastable $s +foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInformation} + + Export the output of Get-Metrics to a csv file that is readable by Excel. + + + "Name","TimestampUTC","Count","Last","Maximum","Minimum","Total","Average","StartTimeUTC","EndTimeUTC","TimeGrain","Unit","DimensionName","DimensionValue","ResourceId" +"AverageResponseTime","2015-03-20 16:15:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website1" +"AverageResponseTime","2015-03-20 16:17:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website1" +"AverageResponseTime","2015-03-20 16:18:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website1" @@ -1662,116 +2400,70 @@ SubStatus : - Add-AlertRule - - - - Remove-AlertRule - - - - Get-AlertRule + Get-Metrics - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - Get-AlertRule + Get-AlertHistory - Gets alert rules + Retrieves the history of alerts. Get - AlertRule + AlertHistory - Gets alert rules either from a ResourceGroup or a particular alert rule if its name or Uri is known. + Retrieves the history of alerts as they get enabled, disabled, fire, resolve, etc. - Get-AlertRule - - ResourceGroup - - The name of the resource group. - - String - - - Name - - The name of the alert rule - - String - + Get-AlertHistory - DetailedOutput + ResourceId - If present, it enables the display of full details in the output. + The resource id the rule is associated to. - SwitchParameter + String - - Profile + + StartTime - In-memory profile (AzureProfile). + Specifies the start time of the query in local time. This parameter is optional. The default is the current local time minus one hour. - AzureProfile + Nullable`1[DateTime] - - - Get-AlertRule - - ResourceGroup + + EndTime - The name of the resource group. + Specifies the end time of the query in local time. This parameter is optional. The default is the current time. - String + Nullable`1[DateTime] - - TargetResourceId + + Status - The Id of the target resource + Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) String - DetailedOutput - - If present, it enables the display of full details in the output. - - SwitchParameter - - - Profile - - In-memory profile (AzureProfile). - - AzureProfile - - - - Get-AlertRule - - ResourceGroup + Caller - The name of the resource group. + Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) String DetailedOutput - If present, it enables the display of full details in the output. + If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) SwitchParameter @@ -1785,10 +2477,10 @@ SubStatus : - - ResourceGroup + + ResourceId - The name of the resource group. + The resource id the rule is associated to. String @@ -1797,10 +2489,46 @@ SubStatus : - - Name + + StartTime - The name of the alert rule + Specifies the start time of the query in local time. This parameter is optional. The default is the current local time minus one hour. + + Nullable`1[DateTime] + + Nullable`1[DateTime] + + + + + + EndTime + + Specifies the end time of the query in local time. This parameter is optional. The default is the current time. + + Nullable`1[DateTime] + + Nullable`1[DateTime] + + + + + + Status + + Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) + + String + + String + + + + + + Caller + + Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) String @@ -1812,7 +2540,7 @@ SubStatus : DetailedOutput - If present, it enables the display of full details in the output. + If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) SwitchParameter @@ -1833,18 +2561,6 @@ SubStatus : - - TargetResourceId - - The Id of the target resource - - String - - String - - - - @@ -1882,37 +2598,155 @@ SubStatus : - -------------------------- Example 1: get alertrules for a ResourceGroup, no details -------------------------- - - PS C:\> - - get-alertrule -res Default-Web-CentralUS - - Gets all the alert rules for a ResourceGroup. The output does not contain details about the rules. - - - - - - - - - - - - - - -------------------------- Example 2: get a single alert rule identified by name, no details -------------------------- + -------------------------- Example 1: GetAlertHistory -------------------------- PS C:\> - get-alertrule -res Default-Web-CentralUS -n myalert-7da64548-214d-42ca-b12b-b245bb8f0ac8 + get-alerthistory -start 2015-02-11T11:00:00 -end 2015-02-11T12:00:00 -det - Gets a single alert rule identified by name and resource group name. -The output contains only basic information about the alert rule. + This command retrieves all the alert rule-related events associated to the current subscription - + Authorization : +Caller : Microsoft.Insights/alertRules +Claims : + http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules +CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2 +Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' has been resolved for Website: + garyyang1 (Default-Web-EastUS) +EventChannels : Admin, Operation +EventDataId : 769fab1c-fc9f-4e18-bc3a-fa79fbdd3616 +EventName : Alert +EventSource : microsoft.insights/alertrules +EventTimestamp : 2/11/2015 7:14:45 PM +HttpRequest : +Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/769fab1c-fc + 9f-4e18-bc3a-fa79fbdd3616/ticks/635592788857929926 +Level : Informational +OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2 +OperationName : ResolveAlert +Properties : + RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- + EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleDescription: + Threshold : 3 + WindowSizeInMinutes: 5 + Aggregation : Total + Operator : GreaterThan + MetricName : CpuTime + MetricUnit : Count +ResourceGroupName : Default-Web-EastUS +ResourceProviderName : microsoft.insights +ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d +Status : Resolved +SubmissionTimestamp : 2/11/2015 7:14:45 PM +SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f +SubStatus : + +Authorization : +Caller : Microsoft.Insights/alertRules +Claims : + http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules +CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 +Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' was activated for Website: garyyang1 + (Default-Web-EastUS) +EventChannels : Admin, Operation +EventDataId : 66277c94-2097-4f5f-860d-e585f1206cd7 +EventName : Alert +EventSource : microsoft.insights/alertrules +EventTimestamp : 2/11/2015 7:04:46 PM +HttpRequest : +Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.web/sites/garyyang1/events/66277c94-2097-4f5f-860d-e585f1206cd7/ticks/6355927828650595 + 14 +Level : Error +OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 +OperationName : ActivateAlert +Properties : + RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- + EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleDescription: + Threshold : 3 + WindowSizeInMinutes: 5 + Aggregation : Total + Operator : GreaterThan + MetricName : CpuTime + MetricUnit : Count +ResourceGroupName : Default-Web-EastUS +ResourceProviderName : microsoft.web +ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.web/sites/garyyang1 +Status : Activated +SubmissionTimestamp : 2/11/2015 7:04:46 PM +SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f +SubStatus : + +Authorization : +Caller : Microsoft.Insights/alertRules +Claims : + http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules +CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 +Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' was activated for Website: garyyang1 + (Default-Web-EastUS) +EventChannels : Admin, Operation +EventDataId : ec9f7b3c-c6ea-4b45-bd15-ff43e38491e3 +EventName : Alert +EventSource : microsoft.insights/alertrules +EventTimestamp : 2/11/2015 7:04:46 PM +HttpRequest : +Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/ec9f7b3c-c6 + ea-4b45-bd15-ff43e38491e3/ticks/635592782865059514 +Level : Error +OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 +OperationName : ActivateAlert +Properties : + RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- + EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleDescription: + Threshold : 3 + WindowSizeInMinutes: 5 + Aggregation : Total + Operator : GreaterThan + MetricName : CpuTime + MetricUnit : Count +ResourceGroupName : Default-Web-EastUS +ResourceProviderName : microsoft.insights +ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d +Status : Activated +SubmissionTimestamp : 2/11/2015 7:04:46 PM +SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f +SubStatus : @@ -1923,16 +2757,108 @@ The output contains only basic information about the alert rule. - -------------------------- Example 3: Gets a particular rule identified by name and provides details about it -------------------------- + -------------------------- Example 2: GetAlertHistory for particular resource -------------------------- PS C:\> - get-alertrule -res Default-Web-CentralUS -n myalert-7da64548-214d-42ca-b12b-b245bb8f0ac8 -det + Get-alerthistory -start 2015-02-11T11:00:00 -end 2015-02-11T12:00:00 -res /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d -det - Gets a particular rule identified by name and resource group name. The output provides details about the rule. + This command retrieves the alert rule-related events associated to the particular resource identified by its resource id (a.k.a. ResourceUri) - + Authorization : +Caller : Microsoft.Insights/alertRules +Claims : + http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules +CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2 +Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' has been resolved for Website: + garyyang1 (Default-Web-EastUS) +EventChannels : Admin, Operation +EventDataId : 769fab1c-fc9f-4e18-bc3a-fa79fbdd3616 +EventName : Alert +EventSource : microsoft.insights/alertrules +EventTimestamp : 2/11/2015 7:14:45 PM +HttpRequest : +Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/769fab1c-fc + 9f-4e18-bc3a-fa79fbdd3616/ticks/635592788857929926 +Level : Informational +OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2 +OperationName : ResolveAlert +Properties : + RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- + EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleDescription: + Threshold : 3 + WindowSizeInMinutes: 5 + Aggregation : Total + Operator : GreaterThan + MetricName : CpuTime + MetricUnit : Count +ResourceGroupName : Default-Web-EastUS +ResourceProviderName : microsoft.insights +ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d +Status : Resolved +SubmissionTimestamp : 2/11/2015 7:14:45 PM +SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f +SubStatus : + +Authorization : +Caller : Microsoft.Insights/alertRules +Claims : + http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/alertRules +CorrelationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 +Description : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' was activated for Website: garyyang1 + (Default-Web-EastUS) +EventChannels : Admin, Operation +EventDataId : ec9f7b3c-c6ea-4b45-bd15-ff43e38491e3 +EventName : Alert +EventSource : microsoft.insights/alertrules +EventTimestamp : 2/11/2015 7:04:46 PM +HttpRequest : +Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/ec9f7b3c-c6 + ea-4b45-bd15-ff43e38491e3/ticks/635592782865059514 +Level : Error +OperationId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj + cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi + LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj + LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0 +OperationName : ActivateAlert +Properties : + RuleUri : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- + EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleName : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d + RuleDescription: + Threshold : 3 + WindowSizeInMinutes: 5 + Aggregation : Total + Operator : GreaterThan + MetricName : CpuTime + MetricUnit : Count +ResourceGroupName : Default-Web-EastUS +ResourceProviderName : microsoft.insights +ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d +Status : Activated +SubmissionTimestamp : 2/11/2015 7:04:46 PM +SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f +SubStatus : @@ -1945,82 +2871,124 @@ The output contains only basic information about the alert rule. - Add-AlertRule + Remove-AlertRule - Get-AlertHistory + Get-AlertRule - Remove-AlertRule + Add-MetricAlertRule - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 + Add-EventAlertRule + + + + Add-WebtestAlertRule + + + + Unknown + - Get-AutoscaleHistory + Get-AlertRule - Retrieves the history of autoscale. + Gets alert rules Get - AutoscaleHistory + AlertRule - Retrieves a list of events related to an autoscale setting. + Gets alert rules either from a ResourceGroup or a particular alert rule if its name or Uri is known. - Get-AutoscaleHistory - - ResourceId + Get-AlertRule + + ResourceGroup + + The name of the resource group. + + String + + + TargetResourceId + + The Id of the target resource + + String + + + DetailedOutput + + If present, it enables the display of full details in the output. + + SwitchParameter + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + + + Get-AlertRule + + ResourceGroup - The resource id the autoscale setting is associated to. + The name of the resource group. String - - StartTime + + Name - Specifies the start time of the query in local time. This parameter is optional. The default is the current local time minus one hour. + The name of the alert rule - Nullable`1[DateTime] + String - - EndTime + + DetailedOutput - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. + If present, it enables the display of full details in the output. - Nullable`1[DateTime] + SwitchParameter - - Status + + Profile - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) + In-memory profile (AzureProfile). - String + AzureProfile - - Caller + + + Get-AlertRule + + ResourceGroup - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) + The name of the resource group. String DetailedOutput - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + If present, it enables the display of full details in the output. SwitchParameter @@ -2034,46 +3002,10 @@ The output contains only basic information about the alert rule. - - ResourceId - - The resource id the autoscale setting is associated to. - - String - - String - - - - - - StartTime - - Specifies the start time of the query in local time. This parameter is optional. The default is the current local time minus one hour. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - - - - EndTime - - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - - - - Status + + ResourceGroup - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) + The name of the resource group. String @@ -2082,10 +3014,10 @@ The output contains only basic information about the alert rule. - - Caller + + TargetResourceId - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) + The Id of the target resource String @@ -2097,7 +3029,7 @@ The output contains only basic information about the alert rule. DetailedOutput - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + If present, it enables the display of full details in the output. SwitchParameter @@ -2118,6 +3050,18 @@ The output contains only basic information about the alert rule. + + Name + + The name of the alert rule + + String + + String + + + + @@ -2155,13 +3099,13 @@ The output contains only basic information about the alert rule. - -------------------------- Example 1: Get all events associated to the subscription -------------------------- + -------------------------- Example 1: get alertrules for a ResourceGroup, no details -------------------------- PS C:\> - Get-AutoscaleHistory -Star 2015-02-09T18:35:00 -end 2015-02-09T18:40:00 -det + get-alertrule -res Default-Web-CentralUS - This command retrieves all the autoscale-related events associated to the current subscription + Gets all the alert rules for a ResourceGroup. The output does not contain details about the rules. @@ -2175,149 +3119,37 @@ The output contains only basic information about the alert rule. - -------------------------- Example 2: GetAutoscaleHistory for a particular resource -------------------------- + -------------------------- Example 2: get a single alert rule identified by name, no details -------------------------- PS C:\> - Get-AutoscaleHistory -Star 2015-02-09T18:35:00 -end 2015-02-09T18:40:00 -res /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS -det + get-alertrule -res Default-Web-CentralUS -n myalert-7da64548-214d-42ca-b12b-b245bb8f0ac8 - This command retrieves the list of autoscale-related events associated to a particular resource identified by the resource's Id (a.k.a. ResourceUri) - - - Authorization : -Caller : Microsoft.Insights/autoscaleSettings -Claims : - http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/autoscaleSettings -CorrelationId : ac5b03ca-05d4-4811-9c27-0314a145f785 -Description : The autoscale engine attempting to scale resource '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deb - a10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm' - from 1 instances count to 2 instances count. -EventChannels : Admin, Operation -EventDataId : c554f7ed-514c-449c-9338-13e15b4b56a3 -EventName : AutoscaleAction -EventSource : microsoft.insights/autoscalesettings -EventTimestamp : 2/10/2015 2:38:19 AM -HttpRequest : -Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS/events/c554f7ed-514c-4 - 49c-9338-13e15b4b56a3/ticks/635591326997519815 -Level : Informational -OperationId : ac5b03ca-05d4-4811-9c27-0314a145f785 -OperationName : ScaleUp -Properties : - Description : The autoscale engine attempting to scale resource '/subscriptions/a93fb07c-6c93 - -40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/De - faultServerFarm' from 1 instances count to 2 instances count. - ResourceName : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- - EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm - OldInstancesCount: 1 - NewInstancesCount: 2 - ActiveAutoscaleProfile: { - "Name": "No scheduled times", - "Capacity": { - "Minimum": "1", - "Maximum": "3", - "Default": "1" - }, - "Rules": [ - { - "MetricTrigger": { - "Name": "CpuPercentage", - "Namespace": "", - "Resource": "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default- - Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm", - "ResourceLocation": "East US", - "TimeGrain": "PT1M", - "Statistic": "Average", - "TimeWindow": "PT45M", - "TimeAggregation": "Average", - "Operator": "GreaterThanOrEqual", - "Threshold": 14.0, - "Source": "WebsiteDedicated:eastuswebspace:DefaultServerFarm" - }, - "ScaleAction": { - "Direction": "Increase", - "Type": "ChangeCount", - "Value": "1", - "Cooldown": "PT5M" - } - }, - { - "MetricTrigger": { - "Name": "CpuPercentage", - "Namespace": "", - "Resource": "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default- - Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm", - "ResourceLocation": "East US", - "TimeGrain": "PT1M", - "Statistic": "Average", - "TimeWindow": "PT45M", - "TimeAggregation": "Average", - "Operator": "LessThanOrEqual", - "Threshold": 4.0, - "Source": "WebsiteDedicated:eastuswebspace:DefaultServerFarm" - }, - "ScaleAction": { - "Direction": "Decrease", - "Type": "ChangeCount", - "Value": "1", - "Cooldown": "PT2H" - } - }, - { - "MetricTrigger": { - "Name": "BytesReceived", - "Namespace": "", - "Resource": "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default- - Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm", - "ResourceLocation": "East US", - "TimeGrain": "PT1M", - "Statistic": "Average", - "TimeWindow": "PT10M", - "TimeAggregation": "Average", - "Operator": "LessThanOrEqual", - "Threshold": 50.0, - "Source": "WebsiteDedicated:eastuswebspace:DefaultServerFarm" - }, - "ScaleAction": { - "Direction": "Decrease", - "Type": "ChangeCount", - "Value": "1", - "Cooldown": "PT10M" - } - }, - { - "MetricTrigger": { - "Name": "BytesReceived", - "Namespace": "", - "Resource": "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default- - Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm", - "ResourceLocation": "East US", - "TimeGrain": "PT1M", - "Statistic": "Average", - "TimeWindow": "PT5M", - "TimeAggregation": "Average", - "Operator": "GreaterThanOrEqual", - "Threshold": 100.0, - "Source": "WebsiteDedicated:eastuswebspace:DefaultServerFarm" - }, - "ScaleAction": { - "Direction": "Increase", - "Type": "ChangeCount", - "Value": "1", - "Cooldown": "PT10M" - } - } - ] - } -ResourceGroupName : Default-Web-EastUS -ResourceProviderName : microsoft.insights -ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ - microsoft.insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS -Status : Succeeded -SubmissionTimestamp : 2/10/2015 2:38:19 AM -SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f -SubStatus : + Gets a single alert rule identified by name and resource group name. +The output contains only basic information about the alert rule. + + + + + + + + + + + + + + -------------------------- Example 3: Gets a particular rule identified by name and provides details about it -------------------------- + + PS C:\> + + get-alertrule -res Default-Web-CentralUS -n myalert-7da64548-214d-42ca-b12b-b245bb8f0ac8 -det + + Gets a particular rule identified by name and resource group name. The output provides details about the rule. + + + @@ -2330,61 +3162,90 @@ SubStatus : - Add-AutoscaleSetting + Get-AlertHistory - Get-AutoscaleSetting + Remove-AlertRule - Remove-AutoscaleSetting + Add-MetricAlertRule - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 + Add-EventAlertRule + + + + Add-WebtestAlertRule + + + + Unknown + - Get-AutoscaleSetting + Get-AutoscaleHistory - Get the autoscale settings + Retrieves the history of autoscale. Get - AutoscaleSetting + AutoscaleHistory - Gets all the autoscale settings associated to the resource group or a single setting identified by a resource group name and the setting + Retrieves a list of events related to an autoscale setting. - Get-AutoscaleSetting - - ResourceGroup + Get-AutoscaleHistory + + ResourceId - The name of the resource group. + The resource id the autoscale setting is associated to. + + String + + + StartTime + + Specifies the start time of the query in local time. This parameter is optional. The default is the current local time minus one hour. + + Nullable`1[DateTime] + + + EndTime + + Specifies the end time of the query in local time. This parameter is optional. The default is the current time. + + Nullable`1[DateTime] + + + Status + + Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) String - Name + Caller - The name of the setting + Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) String DetailedOutput - If present, it enables the display of full details in the output. + If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) SwitchParameter @@ -2398,22 +3259,10 @@ SubStatus : - - ResourceGroup - - The name of the resource group. - - String - - String - - - - - Name + ResourceId - The name of the setting + The resource id the autoscale setting is associated to. String @@ -2422,169 +3271,125 @@ SubStatus : - - DetailedOutput + + StartTime - If present, it enables the display of full details in the output. + Specifies the start time of the query in local time. This parameter is optional. The default is the current local time minus one hour. - SwitchParameter + Nullable`1[DateTime] - SwitchParameter + Nullable`1[DateTime] - - Profile + + EndTime - In-memory profile (AzureProfile). + Specifies the end time of the query in local time. This parameter is optional. The default is the current time. - AzureProfile + Nullable`1[DateTime] - AzureProfile + Nullable`1[DateTime] - - - - - - - - - - - - - - - - - - - - - + + Status - - + Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) - - - - - - - - - - - - - -------------------------- Example 1: GetAutoscaleSetting -------------------------- - - PS C:\> - - get-autoscaleSetting -res Default-Web-EastUS -det - - This command retrieves the autoscale settings associated to a resource group - - - Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft. - insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS -Location : East US -Name : DefaultServerFarm-Default-Web-EastUS -Properties : - Enabled : True - Profiles : - - Capacity : - Default : 1 - Minimum : 3 - Maximum : 1 - FixedDate : - - Name : No scheduled times - Recurrence : - - Rules : - - MetricTrigger : - MetricName : CpuPercentage - MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 - b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm - Operator : GreaterThanOrEqual - Statistic : Average - Threshold : 14 - TimeAggregation : Average - TimeGrain : 00:01:00 - TimeWindow : 00:45:00 - ScaleAction : - Cooldown : 00:05:00 - Direction : Increase - Type : ChangeCount - Value : 1 - - - MetricTrigger : - MetricName : CpuPercentage - MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 - b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm - Operator : LessThanOrEqual - Statistic : Average - Threshold : 4 - TimeAggregation : Average - TimeGrain : 00:01:00 - TimeWindow : 00:45:00 - ScaleAction : - Cooldown : 02:00:00 - Direction : Decrease - Type : ChangeCount - Value : 1 - - - MetricTrigger : - MetricName : BytesReceived - MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 - b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm - Operator : LessThanOrEqual - Statistic : Average - Threshold : 50 - TimeAggregation : Average - TimeGrain : 00:01:00 - TimeWindow : 00:10:00 - ScaleAction : - Cooldown : 00:10:00 - Direction : Decrease - Type : ChangeCount - Value : 1 - - - MetricTrigger : - MetricName : BytesReceived - MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 - b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm - Operator : GreaterThanOrEqual - Statistic : Average - Threshold : 100 - TimeAggregation : Average - TimeGrain : 00:01:00 - TimeWindow : 00:05:00 - ScaleAction : - Cooldown : 00:10:00 - Direction : Increase - Type : ChangeCount - Value : 1 - - - TargetResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/ - providers/microsoft.web/serverFarms/DefaultServerFarm -Tags : {[$type, Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, - Microsoft.WindowsAzure.Management.Common.Storage], [hidden-link:/subscriptions/a93fb07c-6c93-40be-bf3b-4f0 - deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm, - Resource]} + String + + String + + + + + + Caller + + Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) + + String + + String + + + + + + DetailedOutput + + If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + + SwitchParameter + + SwitchParameter + + + + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + AzureProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1: Get all events associated to the subscription -------------------------- + + PS C:\> + + Get-AutoscaleHistory -Star 2015-02-09T18:35:00 -end 2015-02-09T18:40:00 -det + + This command retrieves all the autoscale-related events associated to the current subscription + + + @@ -2595,108 +3400,149 @@ Tags : {[$type, Microsoft.WindowsAzure.Management.Common.Storage.CasePrese - -------------------------- Example 2: GetAutoscaleSetting by resource name -------------------------- + -------------------------- Example 2: GetAutoscaleHistory for a particular resource -------------------------- PS C:\> - get-autoscaleSetting -res Default-Web-EastUS -name DefaultServerFarm-Default-Web-EastUS -det + Get-AutoscaleHistory -Star 2015-02-09T18:35:00 -end 2015-02-09T18:40:00 -res /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS -det - This command retrieves the autoscale settings associated to a resource group and a resource + This command retrieves the list of autoscale-related events associated to a particular resource identified by the resource's Id (a.k.a. ResourceUri) - Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft. - insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS -Location : East US -Name : DefaultServerFarm-Default-Web-EastUS -Properties : - Enabled : True - Profiles : - - Capacity : - Default : 1 - Minimum : 3 - Maximum : 1 - FixedDate : - - Name : No scheduled times - Recurrence : - - Rules : - - MetricTrigger : - MetricName : CpuPercentage - MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 - b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm - Operator : GreaterThanOrEqual - Statistic : Average - Threshold : 14 - TimeAggregation : Average - TimeGrain : 00:01:00 - TimeWindow : 00:45:00 - ScaleAction : - Cooldown : 00:05:00 - Direction : Increase - Type : ChangeCount - Value : 1 - - - MetricTrigger : - MetricName : CpuPercentage - MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 - b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm - Operator : LessThanOrEqual - Statistic : Average - Threshold : 4 - TimeAggregation : Average - TimeGrain : 00:01:00 - TimeWindow : 00:45:00 - ScaleAction : - Cooldown : 02:00:00 - Direction : Decrease - Type : ChangeCount - Value : 1 - - - MetricTrigger : - MetricName : BytesReceived - MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 - b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm - Operator : LessThanOrEqual - Statistic : Average - Threshold : 50 - TimeAggregation : Average - TimeGrain : 00:01:00 - TimeWindow : 00:10:00 - ScaleAction : - Cooldown : 00:10:00 - Direction : Decrease - Type : ChangeCount - Value : 1 - - - MetricTrigger : - MetricName : BytesReceived - MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 - b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm - Operator : GreaterThanOrEqual - Statistic : Average - Threshold : 100 - TimeAggregation : Average - TimeGrain : 00:01:00 - TimeWindow : 00:05:00 - ScaleAction : - Cooldown : 00:10:00 - Direction : Increase - Type : ChangeCount - Value : 1 - - - TargetResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/ - providers/microsoft.web/serverFarms/DefaultServerFarm -Tags : {[$type, Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, - Microsoft.WindowsAzure.Management.Common.Storage], [hidden-link:/subscriptions/a93fb07c-6c93-40be-bf3b-4f0 - deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm, - Resource]} + Authorization : +Caller : Microsoft.Insights/autoscaleSettings +Claims : + http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/autoscaleSettings +CorrelationId : ac5b03ca-05d4-4811-9c27-0314a145f785 +Description : The autoscale engine attempting to scale resource '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deb + a10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm' + from 1 instances count to 2 instances count. +EventChannels : Admin, Operation +EventDataId : c554f7ed-514c-449c-9338-13e15b4b56a3 +EventName : AutoscaleAction +EventSource : microsoft.insights/autoscalesettings +EventTimestamp : 2/10/2015 2:38:19 AM +HttpRequest : +Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS/events/c554f7ed-514c-4 + 49c-9338-13e15b4b56a3/ticks/635591326997519815 +Level : Informational +OperationId : ac5b03ca-05d4-4811-9c27-0314a145f785 +OperationName : ScaleUp +Properties : + Description : The autoscale engine attempting to scale resource '/subscriptions/a93fb07c-6c93 + -40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/De + faultServerFarm' from 1 instances count to 2 instances count. + ResourceName : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- + EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm + OldInstancesCount: 1 + NewInstancesCount: 2 + ActiveAutoscaleProfile: { + "Name": "No scheduled times", + "Capacity": { + "Minimum": "1", + "Maximum": "3", + "Default": "1" + }, + "Rules": [ + { + "MetricTrigger": { + "Name": "CpuPercentage", + "Namespace": "", + "Resource": "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default- + Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm", + "ResourceLocation": "East US", + "TimeGrain": "PT1M", + "Statistic": "Average", + "TimeWindow": "PT45M", + "TimeAggregation": "Average", + "Operator": "GreaterThanOrEqual", + "Threshold": 14.0, + "Source": "WebsiteDedicated:eastuswebspace:DefaultServerFarm" + }, + "ScaleAction": { + "Direction": "Increase", + "Type": "ChangeCount", + "Value": "1", + "Cooldown": "PT5M" + } + }, + { + "MetricTrigger": { + "Name": "CpuPercentage", + "Namespace": "", + "Resource": "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default- + Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm", + "ResourceLocation": "East US", + "TimeGrain": "PT1M", + "Statistic": "Average", + "TimeWindow": "PT45M", + "TimeAggregation": "Average", + "Operator": "LessThanOrEqual", + "Threshold": 4.0, + "Source": "WebsiteDedicated:eastuswebspace:DefaultServerFarm" + }, + "ScaleAction": { + "Direction": "Decrease", + "Type": "ChangeCount", + "Value": "1", + "Cooldown": "PT2H" + } + }, + { + "MetricTrigger": { + "Name": "BytesReceived", + "Namespace": "", + "Resource": "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default- + Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm", + "ResourceLocation": "East US", + "TimeGrain": "PT1M", + "Statistic": "Average", + "TimeWindow": "PT10M", + "TimeAggregation": "Average", + "Operator": "LessThanOrEqual", + "Threshold": 50.0, + "Source": "WebsiteDedicated:eastuswebspace:DefaultServerFarm" + }, + "ScaleAction": { + "Direction": "Decrease", + "Type": "ChangeCount", + "Value": "1", + "Cooldown": "PT10M" + } + }, + { + "MetricTrigger": { + "Name": "BytesReceived", + "Namespace": "", + "Resource": "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default- + Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm", + "ResourceLocation": "East US", + "TimeGrain": "PT1M", + "Statistic": "Average", + "TimeWindow": "PT5M", + "TimeAggregation": "Average", + "Operator": "GreaterThanOrEqual", + "Threshold": 100.0, + "Source": "WebsiteDedicated:eastuswebspace:DefaultServerFarm" + }, + "ScaleAction": { + "Direction": "Increase", + "Type": "ChangeCount", + "Value": "1", + "Cooldown": "PT10M" + } + } + ] + } +ResourceGroupName : Default-Web-EastUS +ResourceProviderName : microsoft.insights +ResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/ + microsoft.insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS +Status : Succeeded +SubmissionTimestamp : 2/10/2015 2:38:19 AM +SubscriptionId : b93fb07a-6f93-30be-bf3e-4f0deca15f4f +SubStatus : @@ -2713,80 +3559,53 @@ Tags : {[$type, Microsoft.WindowsAzure.Management.Common.Storage.CasePrese - Get-AutoscaleHistory + Get-AutoscaleSetting Remove-AutoscaleSetting - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - Get-AzureRmCorrelationIdLog + Get-AutoscaleSetting - Gets the operations associated with a CorrelationId + Get the autoscale settings Get - AzureCorrelationIdLog + AutoscaleSetting - Gets the operations associated with a CorrelationId. + Gets all the autoscale settings associated to the resource group or a single setting identified by a resource group name and the setting - Get-AzureRmCorrelationIdLog - - CorrelationId - - Specifies a filter by correlationId. This parameter is mandatory. - - String - - - StartTime - - Specifies the start time of the query in local time. This parameter is optional. -The default is EndTime minus one hour. - - Nullable`1[DateTime] - - - EndTime - - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. -The value must be earlier than StartTime, but not more than 15 days. - - Nullable`1[DateTime] - - - Status + Get-AutoscaleSetting + + ResourceGroup - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) + The name of the resource group. String - Caller + Name - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) + The name of the setting String DetailedOutput - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + If present, it enables the display of full details in the output. SwitchParameter @@ -2800,48 +3619,10 @@ The value must be earlier than StartTime, but not more than 15 days. - - CorrelationId - - Specifies a filter by correlationId. This parameter is mandatory. - - String - - String - - - - - - StartTime - - Specifies the start time of the query in local time. This parameter is optional. -The default is EndTime minus one hour. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - EndTime minus one hour - - - EndTime - - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. -The value must be earlier than StartTime, but not more than 15 days. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - Current time - - - Status + + ResourceGroup - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) + The name of the resource group. String @@ -2851,9 +3632,9 @@ The value must be earlier than StartTime, but not more than 15 days. - Caller + Name - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) + The name of the setting String @@ -2865,7 +3646,7 @@ The value must be earlier than StartTime, but not more than 15 days. DetailedOutput - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + If present, it enables the display of full details in the output. SwitchParameter @@ -2890,7 +3671,7 @@ The value must be earlier than StartTime, but not more than 15 days. - None + @@ -2903,7 +3684,7 @@ The value must be earlier than StartTime, but not more than 15 days. - None + @@ -2923,36 +3704,108 @@ The value must be earlier than StartTime, but not more than 15 days. - -------------------------- Example 1: GetAzureCorrelationIdLog -------------------------- - - PS C:\> - - PS C:\>Get-AzureRmCorrelationIdLog -CorrelationId 60c694d0-e46f-4c12-bed1-9b7aef541c23 - - This command lists all the operations associated to the given CorrelationId that took place in the last hour. - - - - - - - - - - - - - - -------------------------- Example 2: GetAzureCorrelationIdLog with starttime only -------------------------- + -------------------------- Example 1: GetAutoscaleSetting -------------------------- PS C:\> - PS C:\>Get-AzureRmCorrelationIdLog -CorrelationId 60c694d0-e46f-4c12-bed1-9b7aef541c23 -StartTime 2015-01-15T04:30:00 + get-autoscaleSetting -res Default-Web-EastUS -det - This command lists all the operations associated to the given CorrelationId that took place on or after 2015-01-01T10:30 local time. + This command retrieves the autoscale settings associated to a resource group - + Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft. + insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS +Location : East US +Name : DefaultServerFarm-Default-Web-EastUS +Properties : + Enabled : True + Profiles : + + Capacity : + Default : 1 + Minimum : 3 + Maximum : 1 + FixedDate : + + Name : No scheduled times + Recurrence : + + Rules : + + MetricTrigger : + MetricName : CpuPercentage + MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 + b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm + Operator : GreaterThanOrEqual + Statistic : Average + Threshold : 14 + TimeAggregation : Average + TimeGrain : 00:01:00 + TimeWindow : 00:45:00 + ScaleAction : + Cooldown : 00:05:00 + Direction : Increase + Type : ChangeCount + Value : 1 + + + MetricTrigger : + MetricName : CpuPercentage + MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 + b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm + Operator : LessThanOrEqual + Statistic : Average + Threshold : 4 + TimeAggregation : Average + TimeGrain : 00:01:00 + TimeWindow : 00:45:00 + ScaleAction : + Cooldown : 02:00:00 + Direction : Decrease + Type : ChangeCount + Value : 1 + + + MetricTrigger : + MetricName : BytesReceived + MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 + b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm + Operator : LessThanOrEqual + Statistic : Average + Threshold : 50 + TimeAggregation : Average + TimeGrain : 00:01:00 + TimeWindow : 00:10:00 + ScaleAction : + Cooldown : 00:10:00 + Direction : Decrease + Type : ChangeCount + Value : 1 + + + MetricTrigger : + MetricName : BytesReceived + MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 + b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm + Operator : GreaterThanOrEqual + Statistic : Average + Threshold : 100 + TimeAggregation : Average + TimeGrain : 00:01:00 + TimeWindow : 00:05:00 + ScaleAction : + Cooldown : 00:10:00 + Direction : Increase + Type : ChangeCount + Value : 1 + + + TargetResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/ + providers/microsoft.web/serverFarms/DefaultServerFarm +Tags : {[$type, Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage], [hidden-link:/subscriptions/a93fb07c-6c93-40be-bf3b-4f0 + deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm, + Resource]} @@ -2963,16 +3816,108 @@ The value must be earlier than StartTime, but not more than 15 days. - -------------------------- Example 3: GetAzureCorrelationIdLog with start and end times -------------------------- + -------------------------- Example 2: GetAutoscaleSetting by resource name -------------------------- PS C:\> - PS C:\>Get-AzureRmCorrelationIdLog -CorrelationId 60c694d0-e46f-4c12-bed1-9b7aef541c23 -StartTime 2015-01-15T04:30:00 -EndTime 2015-01-15T12:30:00 + get-autoscaleSetting -res Default-Web-EastUS -name DefaultServerFarm-Default-Web-EastUS -det - This command lists all the operations associated to the given CorrelationId that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. + This command retrieves the autoscale settings associated to a resource group and a resource - + Id : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft. + insights/autoscalesettings/DefaultServerFarm-Default-Web-EastUS +Location : East US +Name : DefaultServerFarm-Default-Web-EastUS +Properties : + Enabled : True + Profiles : + + Capacity : + Default : 1 + Minimum : 3 + Maximum : 1 + FixedDate : + + Name : No scheduled times + Recurrence : + + Rules : + + MetricTrigger : + MetricName : CpuPercentage + MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 + b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm + Operator : GreaterThanOrEqual + Statistic : Average + Threshold : 14 + TimeAggregation : Average + TimeGrain : 00:01:00 + TimeWindow : 00:45:00 + ScaleAction : + Cooldown : 00:05:00 + Direction : Increase + Type : ChangeCount + Value : 1 + + + MetricTrigger : + MetricName : CpuPercentage + MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 + b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm + Operator : LessThanOrEqual + Statistic : Average + Threshold : 4 + TimeAggregation : Average + TimeGrain : 00:01:00 + TimeWindow : 00:45:00 + ScaleAction : + Cooldown : 02:00:00 + Direction : Decrease + Type : ChangeCount + Value : 1 + + + MetricTrigger : + MetricName : BytesReceived + MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 + b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm + Operator : LessThanOrEqual + Statistic : Average + Threshold : 50 + TimeAggregation : Average + TimeGrain : 00:01:00 + TimeWindow : 00:10:00 + ScaleAction : + Cooldown : 00:10:00 + Direction : Decrease + Type : ChangeCount + Value : 1 + + + MetricTrigger : + MetricName : BytesReceived + MetricResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4 + b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm + Operator : GreaterThanOrEqual + Statistic : Average + Threshold : 100 + TimeAggregation : Average + TimeGrain : 00:01:00 + TimeWindow : 00:05:00 + ScaleAction : + Cooldown : 00:10:00 + Direction : Increase + Type : ChangeCount + Value : 1 + + + TargetResourceId : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/ + providers/microsoft.web/serverFarms/DefaultServerFarm +Tags : {[$type, Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, + Microsoft.WindowsAzure.Management.Common.Storage], [hidden-link:/subscriptions/a93fb07c-6c93-40be-bf3b-4f0 + deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/serverFarms/DefaultServerFarm, + Resource]} @@ -2985,23 +3930,15 @@ The value must be earlier than StartTime, but not more than 15 days. - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - - Get-AzureRmSubscriptionIdLog - - - - Get-AzureRmResourceGroupLog + Add-AutoscaleSetting - Get-AzureRmResourceLog + Get-AutoscaleHistory - Get-AzureRmResourceProviderLog + Remove-AutoscaleSetting @@ -3009,34 +3946,177 @@ The value must be earlier than StartTime, but not more than 15 days. - Get-AzureRmResourceGroupLog + Get-AzureRmLog - Gets the operations associated with a Resource Group + Gets the events associated with the current SubscriptionId or CorrelationId or Resource Group or ResourceId or Resource Provider Get - AzureResourceGroupLog + AzureRmLog - Gets the operations associated with a Resource Group. + Gets the events associated with the current SubscriptionId or CorrelationId or Resource Group or ResourceId or Resource Provider. - Get-AzureRmResourceGroupLog + Get-AzureRmLog + + StartTime + + Specifies the start time of the query in local time. This parameter is optional. +The default is EndTime minus one hour. + + Nullable`1[DateTime] + + + EndTime + + Specifies the end time of the query in local time. This parameter is optional. The default is the current time. +The value must be earlier than StartTime, but not more than 15 days. + + Nullable`1[DateTime] + + + Status + + Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) + + String + + + Caller + + Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) + + String + + + DetailedOutput + + If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + + SwitchParameter + ResourceGroup - Specifies a filter by ResourceGroup. This parameter is mandatory. + Specifies a filter by ResourceGroup. This parameter is mandatory. + + String + + + MaxEvents + + If present it indicates total number of events to be fetched for the filter specified. This parameter is optional. The default is 1000. + + Int32 + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRmLog + + StartTime + + Specifies the start time of the query in local time. This parameter is optional. +The default is EndTime minus one hour. + + Nullable`1[DateTime] + + + EndTime + + Specifies the end time of the query in local time. This parameter is optional. The default is the current time. +The value must be earlier than StartTime, but not more than 15 days. + + Nullable`1[DateTime] + + + Status + + Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) + + String + + + Caller + + Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) + + String + + + DetailedOutput + + If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + + SwitchParameter + + + ResourceProvider + + Specifies a filter by ResourceProvider. This parameter is mandatory. + + String + + + MaxEvents + + If present it indicates total number of events to be fetched for the filter specified. This parameter is optional. The default is 1000. + + Int32 + + + Profile + + In-memory profile (AzureProfile). + + AzureProfile + + + InformationAction + + + + ActionPreference + + + InformationVariable + + String + + + Get-AzureRmLog StartTime - Specifies the start time of the query in local time. This parameter is optional. + Specifies the start time of the query in local time. This parameter is optional. The default is EndTime minus one hour. Nullable`1[DateTime] @@ -3070,6 +4150,20 @@ The value must be earlier than StartTime, but not more than 15 days. SwitchParameter + + CorrelationId + + Specifies a filter by correlationId. This parameter is mandatory. + + String + + + MaxEvents + + If present it indicates total number of events to be fetched for the filter specified. This parameter is optional. The default is 1000. + + Int32 + Profile @@ -3077,250 +4171,27 @@ The value must be earlier than StartTime, but not more than 15 days. AzureProfile - - - - - ResourceGroup - - Specifies a filter by ResourceGroup. This parameter is mandatory. - - String - - String - - - - - - StartTime - - Specifies the start time of the query in local time. This parameter is optional. -The default is EndTime minus one hour. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - EndTime minus one hour - - - EndTime - - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. -The value must be earlier than StartTime, but not more than 15 days. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - Current time - - - Status - - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) - - String - - String - - - - - - Caller - - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) - - String - - String - - - - - - DetailedOutput - - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) - - SwitchParameter - - SwitchParameter - - - - - - Profile - - In-memory profile (AzureProfile). - - AzureProfile - - AzureProfile - - - - - - - - - None - - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - - -------------------------- Example 1: GetAzureResourceGroupLog -------------------------- - - PS C:\> - - PS C:\>Get-AzureRmResourceGroupLog -ResourceGroup Default-Web-CentralUS - - This command lists all the operations associated to the given Resource Group that took place in the last hour. - - - - - - - - - - - - - - -------------------------- Example 2: GetAzureResourceGroupLog with starttime only -------------------------- - - PS C:\> - - PS C:\>Get-AzureRmResourceGroupLog -ResourceGroup Default-Web-CentralUS -StartTime 2015-01-01T10:30 - - This command lists all the operations associated to the given Resource Group that took place on or after 2015-01-01T10:30 local time. - - - - - - - - - - - - - - -------------------------- Example 3: GetAzureResourceGroupLog with start and end times -------------------------- - - PS C:\> - - PS C:\>Get-AzureRmResourceGroupLog -ResourceGroup Default-Web-CentralUS -StartTime 2015-01-01T10:30 -EndTime 2015-01-01T11:30 - - This command lists all the operations associated to the given Resource Group that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. - - - - - - - - - - - - - - - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - - Get-AzureRmSubscriptionIdLog - - - - Get-AzureRmCorrelationIdLog - - - - Get-AzureRmResourceLog - - - - Get-AzureRmResourceProviderLog - - - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - - - - - - Get-AzureRmResourceLog - - Gets the operations associated with a ResourceId - - - - - Get - AzureResourceLog - - - - Gets the operations associated with a ResourceId. - - - - Get-AzureRmResourceLog - - ResourceId + + InformationAction - Specifies a filter by ResoruceId. This parameter is mandatory. + + + ActionPreference + + + InformationVariable + + String + + + Get-AzureRmLog StartTime - Specifies the start time of the query in local time. This parameter is optional. + Specifies the start time of the query in local time. This parameter is optional. The default is EndTime minus one hour. Nullable`1[DateTime] @@ -3348,11 +4219,25 @@ The value must be earlier than StartTime, but not more than 15 days. String - DetailedOutput + DetailedOutput + + If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + + SwitchParameter + + + ResourceId + + Specifies a filter by ResoruceId. This parameter is mandatory. + + String + + + MaxEvents - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) + If present it indicates total number of events to be fetched for the filter specified. This parameter is optional. The default is 1000. - SwitchParameter + Int32 Profile @@ -3361,246 +4246,27 @@ The value must be earlier than StartTime, but not more than 15 days. AzureProfile - - - - - ResourceId - - Specifies a filter by ResoruceId. This parameter is mandatory. - - String - - String - - - - - - StartTime - - Specifies the start time of the query in local time. This parameter is optional. -The default is EndTime minus one hour. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - EndTime minus one hour - - - EndTime - - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. -The value must be earlier than StartTime, but not more than 15 days. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - Current time - - - Status - - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) - - String - - String - - - - - - Caller - - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) - - String - - String - - - - - - DetailedOutput - - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) - - SwitchParameter - - SwitchParameter - - - - - - Profile - - In-memory profile (AzureProfile). - - AzureProfile - - AzureProfile - - - - - - - - - None - - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - - -------------------------- Example 1: GetAzureResourceLog -------------------------- - - PS C:\> - - PS C:\>Get-AzureRmResourceLog -ResourceId /subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/resourcegroups/Default-Web-CentralUS/providers/Microsoft.Web/serverFarms/Default1 - - This command lists all the operations associated to the given ResourceId that took place in the last hour. - - - - - - - - - - - - - - -------------------------- Example 2: GetAzureResourceLog with starttime only -------------------------- - - PS C:\> - - PS C:\>Get-AzureRmResourceLog -ResourceId /subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/resourcegroups/Default-Web-CentralUS/providers/Microsoft.Web/serverFarms/Default1 -StartTime 2015-01-01T10:30 - - This command lists all the operations associated to the given ResourceId that took place on or after 2015-01-01T10:30 local time. - - - - - - - - - - - - - - -------------------------- Example 3: GetAzureResourceLog with start and end times -------------------------- - - PS C:\> - - PS C:\>Get-AzureRmResourceLog -ResourceId /subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/resourcegroups/Default-Web-CentralUS/providers/Microsoft.Web/serverFarms/Default1 -StartTime 2015-01-01T10:30 -EndTime 2015-01-01T11:30 - - This command lists all the operations associated to the given ResourceId that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. - - - - - - - - - - - - - - - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - - Get-AzureRmSubscriptionIdLog - - - - Get-AzureRmCorrelationIdLog - - - - Get-AzureRmResourceGroupLog - - - - Get-AzureRmResourceProviderLog - - - - - - - - Get-AzureRmResourceProviderLog - - Gets the operations associated with a Resource Provider (RP) for Azure Resource Manager (ARM). You can use the Get-AzureRmResourceProvider command to list out the ARM Resource Providers that are available. By default, this command retrieves Resource Provider log entries for the last hour, however you can specify custom start and end times to get log entries from a specific time period. - - - - - Get - AzureResourceProviderLog - - - - Gets the operations associated with a Resource Provider. - - - - Get-AzureRmResourceProviderLog - - ResourceProvider + + InformationAction + + + + ActionPreference + + + InformationVariable - Specifies a filter by ResourceProvider. This parameter is mandatory. To discover a list of Resource Providers, use the Get-AzureRmResourceProvider command. + String + + + Get-AzureRmLog StartTime - A System.DateTime instance that specifies the timestamp (in local time) of the earliest log entry to retrieve. This parameter is optional. + Specifies the start time of the query in local time. This parameter is optional. The default is EndTime minus one hour. Nullable`1[DateTime] @@ -3608,57 +4274,67 @@ The default is EndTime minus one hour. EndTime - A System.DateTime instance that specifies the timestamp (in Local Time) of the latest log entry to retrieve. This parameter is optional. The default value of this parameter is the current time. The EndTime parameter value must be later than the StartTime, but not by more than fifteen (15) days. + Specifies the end time of the query in local time. This parameter is optional. The default is the current time. +The value must be earlier than StartTime, but not more than 15 days. Nullable`1[DateTime] Status - Specifies a filter by status. This parameter is optional. The default value is an empty string, which will not perform any filtering. + Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) String Caller - Specifies a filter by caller. This parameter is optional. The default value is an empty string (i.e. no filter) + Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) String DetailedOutput - If present it indicates that the output will be detailed. This parameter is optional. The default is $false, which results in summarized output. + If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) SwitchParameter + + MaxEvents + + If present it indicates total number of events to be fetched for the filter specified. This parameter is optional. The default is 1000. + + Int32 + Profile - In-memory profile (AzureProfile). You can create an Azure Profile by using the New-AzureRmProfile command. + In-memory profile (AzureProfile). AzureProfile - - - - - ResourceProvider - - Specifies a filter by ResourceProvider. This parameter is mandatory. - - String - - String - - - - + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + StartTime - Specifies the start time of the query in local time. This parameter is optional. + Specifies the start time of the query in local time. This parameter is optional. The default is EndTime minus one hour. Nullable`1[DateTime] @@ -3717,6 +4393,30 @@ The value must be earlier than StartTime, but not more than 15 days. + + ResourceGroup + + Specifies a filter by ResourceGroup. This parameter is mandatory. + + String + + String + + + + + + MaxEvents + + If present it indicates total number of events to be fetched for the filter specified. This parameter is optional. The default is 1000. + + Int32 + + Int32 + + + + Profile @@ -3729,6 +4429,66 @@ The value must be earlier than StartTime, but not more than 15 days. + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + ResourceProvider + + Specifies a filter by ResourceProvider. This parameter is mandatory. + + String + + String + + + + + + CorrelationId + + Specifies a filter by correlationId. This parameter is mandatory. + + String + + String + + + + + + ResourceId + + Specifies a filter by ResoruceId. This parameter is mandatory. + + String + + String + + + + @@ -3738,8 +4498,7 @@ The value must be earlier than StartTime, but not more than 15 days. - - + @@ -3751,8 +4510,7 @@ The value must be earlier than StartTime, but not more than 15 days. - - + @@ -3766,13 +4524,222 @@ The value must be earlier than StartTime, but not more than 15 days. - -------------------------- Example 1: GetAzureResourceProviderLog -------------------------- + -------------------------- Example 1: GetAzureRmLog by SubscriptionId -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog + + This command lists all the events associated to the user's subscriptionId (see Add-AzureAccount for details) that took place in the last hour. + + + + + + + + + + + + + + -------------------------- Example 2: GetAzureRmLog by SubscriptionId with MaxEvents -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -MaxEvents 100 + + + This command lists maximum of 100 events associated to the user's subscriptionId (see Add-AzureAccount for details) that took place in the last hour. + + + + + + + + + + + + + + -------------------------- Example 2: GetAzureRmLog by SubscriptionId with starttime only -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -StartTime 2015-01-01T10:30 + + + + This command lists all the events associated to the user's subscriptionId (see Add-AzureAccount for details) that took place on or after 2015-01-01T10:30 local time. + + + + + + + + + + + + + + -------------------------- Example 4: GetAzureRmLog by SubscriptionId with start and end times -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -StartTime 2015-01-01T10:30 -EndTime 2015-01-01T11:30 + + + This command lists all the events associated to the user's subscriptionId (see Add-AzureAccount for details) that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. + + + + + + + + + + + + + + -------------------------- Example 5: GetAzureRmLog by CorrelationId -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -CorrelationId 60c694d0-e46f-4c12-bed1-9b7aef541c23 + + + This command lists all the events associated to the given CorrelationId that took place in the last hour. + + + + + + + + + + + + + + -------------------------- Example 6: GetAzureRmLog by CorrelationId with MaxEvents -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -CorrelationId 60c694d0-e46f-4c12-bed1-9b7aef541c23 -MaxEvents 100 + + This command lists maximum of 100 events associated to the given CorrelationId that took place in the last hour. + + + + + + + + + + + + + + -------------------------- Example 7: GetAzureRmLog by CorrelationId with starttime only -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -CorrelationId 60c694d0-e46f-4c12-bed1-9b7aef541c23 -StartTime 2015-01-15T04:30:00 + + + This command lists all the events associated to the given CorrelationId that took place on or after 2015-01-01T10:30 local time. + + + + + + + + + + + + + + -------------------------- Example 8: GetAzureRmLog by CorrelationId with start and end times -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -CorrelationId 60c694d0-e46f-4c12-bed1-9b7aef541c23 -StartTime 2015-01-15T04:30:00 -EndTime 2015-01-15T12:30:00 + + + This command lists all the events associated to the given CorrelationId that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. + + + + + + + + + + + + + + -------------------------- Example 9: GetAzureRmLog by ResourceGroup -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -ResourceGroup Default-Web-CentralUS + + This command lists all the events associated to the given Resource Group that took place in the last hour. + + + + + + + + + + + + + + -------------------------- Example 10: GetAzureRmLog by ResourceGroup with MaxEvents -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -ResourceGroup Default-Web-CentralUS -MaxEvents 100 + + + This command lists maximum of 100 events associated to the given Resource Group that took place in the last hour. + + + + + + + + + + + + + + -------------------------- Example 11: GetAzureRmLog by ResourceGroup with starttime only -------------------------- PS C:\> - PS C:\>Get-AzureRmResourceProviderLog -ResourceProvider Microsoft.Web + PS C:\>Get-AzureRmLog -ResourceGroup Default-Web-CentralUS -StartTime 2015-01-01T10:30 + - This command lists all the operations associated to the given Resource Provider that took place in the last hour. + This command lists all the events associated to the given Resource Group that took place on or after 2015-01-01T10:30 local time. @@ -3786,13 +4753,14 @@ The value must be earlier than StartTime, but not more than 15 days. - -------------------------- Example 2: GetAzureResourceProviderLog with starttime only -------------------------- + -------------------------- Example 12: GetAzureRmLog by ResourceGroup with start and end times -------------------------- PS C:\> - PS C:\>Get-AzureRmResourceProviderLog -ResourceProvider Microsoft.Web -StartTime 2015-01-01T10:30 + PS C:\>Get-AzureRmLog -ResourceGroup Default-Web-CentralUS -StartTime 2015-01-01T10:30 -EndTime 2015-01-01T11:30 + - This command lists all the operations associated to the given Resource Provider that took place on or after 2015-01-01T10:30 local time. + This command lists all the events associated to the given Resource Group that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. @@ -3806,13 +4774,15 @@ The value must be earlier than StartTime, but not more than 15 days. - -------------------------- Example 3: GetAzureResourceProviderLog with start and end times -------------------------- + -------------------------- Example 13: GetAzureRmLog by ResourceId -------------------------- PS C:\> - PS C:\>Get-AzureRmResourceProviderLog -ResourceProvider Microsoft.Web -StartTime 2015-01-01T10:30 -EndTime 2015-01-01T11:30 + PS C:\>Get-AzureRmLog -ResourceId /subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/resourcegroups/Default-Web-CentralUS/providers/Microsoft.Web/serverFarms/Default1 + - This command lists all the operations associated to the given Resource Provider that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. + This command lists all the events associated to the given ResourceId that took place in the last hour. + @@ -3825,215 +4795,99 @@ The value must be earlier than StartTime, but not more than 15 days. - - - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - - Get-AzureRmSubscriptionIdLog - - - - Get-AzureRmCorrelationIdLog - - - - Get-AzureRmResourceGroupLog - - - - Get-AzureRmResourceLog - - - - - - - - Get-AzureRmSubscriptionIdLog - - Gets the operations associated with the current subscriptionId - - - - - Get - AzureSubscriptionIdLog - - - - Gets the operations associated with the current subscriptionId. - - - - Get-AzureRmSubscriptionIdLog - - StartTime - - Specifies the start time of the query in local time. This parameter is optional. -The default is EndTime minus one hour. - - Nullable`1[DateTime] - - - EndTime - - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. -The value must be earlier than StartTime, but not more than 15 days. - - Nullable`1[DateTime] - - - Status - - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) - - String - - - Caller - - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) - - String - - - DetailedOutput - - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) - - SwitchParameter - - - Profile - - In-memory profile (AzureProfile). - - AzureProfile - - - - - - StartTime - - Specifies the start time of the query in local time. This parameter is optional. -The default is EndTime minus one hour. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - - - - EndTime - - Specifies the end time of the query in local time. This parameter is optional. The default is the current time. -The value must be earlier than StartTime, but not more than 15 days. - - Nullable`1[DateTime] - - Nullable`1[DateTime] - - - Current time - - - Status - - Specifies a filter by status. This parameter is optional. The fault is an empty string (i.e. no filter) - - String - - String - - - - - - Caller - - Specifies a filter by caller. This parameter is optional. The fault is an empty string (i.e. no filter) - - String - - String - - - - - - DetailedOutput - - If present it indicates that the output will be detailed. This parameter is optional. The default is no (i.e. summarized output.) - - SwitchParameter - - SwitchParameter - - - - - - Profile - - In-memory profile (AzureProfile). - - AzureProfile - - AzureProfile - - - - - - - - - None - - - - - - - - - - - - - None - - - - - + + -------------------------- Example 14: GetAzureRmLog by ResourceId with MaxEvents -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -ResourceId /subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/resourcegroups/Default-Web-CentralUS/providers/Microsoft.Web/serverFarms/Default1 -MaxEvents 100 + + This command lists maximum of 100 events associated to the given ResourceId that took place in the last hour. - - - - - - - - - - - - + + + + + + + + + + + + + + -------------------------- Example 15: GetAzureRmLog by ResourceId with starttime only -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -ResourceId /subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/resourcegroups/Default-Web-CentralUS/providers/Microsoft.Web/serverFarms/Default1 -StartTime 2015-01-01T10:30 + + + This command lists all the events associated to the given ResourceId that took place on or after 2015-01-01T10:30 local time. + + + + + + + + + + + + + + -------------------------- Example 16: GetAzureRmLog by ResourceId with start and end times -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -ResourceId /subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab/resourcegroups/Default-Web-CentralUS/providers/Microsoft.Web/serverFarms/Default1 -StartTime 2015-01-01T10:30 -EndTime 2015-01-01T11:30 + + + This command lists all the events associated to the given ResourceId that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. + + + + + + + + + + + + + + -------------------------- Example 17: GetAzureRmLog by ResourceProvider -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmLog -ResourceProvider Microsoft.Web + + + This command lists all the events associated to the given Resource Provider that took place in the last hour. + + + + + + + + + + + + - -------------------------- Example 1: GetAzureSubscriptionIdLog -------------------------- + -------------------------- Example 18: GetAzureRmLog by ResourceProvider with MaxEvents -------------------------- PS C:\> - PS C:\>Get-AzureRmSubscriptionIdLog + PS C:\>Get-AzureRmLog -ResourceProvider Microsoft.Web -MaxEvents 100 + - This command lists all the operations associated to the user's subscriptionId (see Add-AzureRmAccount for details) that took place in the last hour. + This command lists maximum of 100 events associated to the given Resource Provider that took place in the last hour. @@ -4047,13 +4901,14 @@ The value must be earlier than StartTime, but not more than 15 days. - -------------------------- Example 2: GetAzureSubscriptionIdLog with starttime only -------------------------- + -------------------------- Example 19: GetAzureRmLog by ResourceProvider with starttime only -------------------------- PS C:\> - PS C:\>Get-AzureRmSubscriptionIdLog -StartTime 2015-01-01T10:30 + PS C:\>Get-AzureRmLog -ResourceProvider Microsoft.Web -StartTime 2015-01-01T10:30 + - This command lists all the operations associated to the user's subscriptionId (see Add-AzureRmAccount for details) that took place on or after 2015-01-01T10:30 local time. + This command lists all the events associated to the given Resource Provider that took place on or after 2015-01-01T10:30 local time. @@ -4067,13 +4922,15 @@ The value must be earlier than StartTime, but not more than 15 days. - -------------------------- Example 3: GetAzureSubscriptionIdLog with start and end times -------------------------- + -------------------------- Example 20: GetAzureRmLog by ResourceProvider with start and end times -------------------------- PS C:\> - PS C:\>Get-AzureRmSubscriptionIdLog -StartTime 2015-01-01T10:30 -EndTime 2015-01-01T11:30 + PS C:\>Get-AzureRmLog -ResourceProvider Microsoft.Web -StartTime 2015-01-01T10:30 -EndTime 2015-01-01T11:30 + - This command lists all the operations associated to the user's subscriptionId (see Add-AzureRmAccount for details) that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. + This command lists all the events associated to the given Resource Provider that took place on or after 2015-01-01T10:30 local time, but before 2015-01-01T11:30 local time. + @@ -4089,25 +4946,9 @@ The value must be earlier than StartTime, but not more than 15 days. - Online Version: + Online Version http://go.microsoft.com/fwlink/?LinkID=397618 - - Get-AzureRmCorrelationIdLog - - - - Get-AzureRmResourceGroupLog - - - - Get-AzureRmResourceLog - - - - Get-AzureRmResourceProviderLog - - @@ -4218,7 +5059,8 @@ The value must be earlier than StartTime, but not more than 15 days. - + + @@ -4230,7 +5072,8 @@ The value must be earlier than StartTime, but not more than 15 days. - + + @@ -4248,8 +5091,7 @@ The value must be earlier than StartTime, but not more than 15 days. PS C:\> - get-metricdefinitions -res /subscriptions/d33fb0c7-69d3-40be-e35b-4f0deba70fff/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website2 - + get-metricdefinitions -res /subscriptions/d33fb0c7-69d3-40be-e35b-4f0deba70fff/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website2 Gets all the metrics definitions for the given resource (identified by the ResourceId) @@ -4388,10 +5230,6 @@ Unit : Bytes - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - Get-Metrics @@ -4442,8 +5280,7 @@ Unit : Bytes EndTime - Latest Time/Date to search for metric values. - + Latest Time/Date to search for metric values. DateTime @@ -4510,8 +5347,7 @@ Unit : Bytes EndTime - Latest Time/Date to search for metric values. - + Latest Time/Date to search for metric values. DateTime @@ -4565,7 +5401,8 @@ Unit : Bytes - + + @@ -4578,7 +5415,7 @@ Unit : Bytes - + @@ -4757,10 +5594,6 @@ Unit : Count - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - Get-MetricDefinitions @@ -4917,7 +5750,8 @@ Unit : Count - + + @@ -4944,7 +5778,7 @@ Unit : Count - -------------------------- Example 1: Querying with resaourceId only -------------------------- + -------------------------- Example 1: Querying with resourceId only -------------------------- PS C:\> @@ -4953,7 +5787,7 @@ Unit : Count Query the usage metrics for a website - + @@ -4966,8 +5800,12 @@ Unit : Count - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 + Get-Metrics + + + + Unknown + @@ -5019,41 +5857,6 @@ Unit : Count String - - RecurrenceFrequency - - The frequency of recurrence. The allowed values are: None, Second, Minute, Hour, Day, Week, Month, Year. Not all those values are supported. - - RecurrenceFrequency - - - ScheduleDays - - A list of days scheduled. - - List`1[String] - - - ScheduleHours - - A list of scheduled hours. - - List`1[Int32] - - - ScheduleMinutes - - List of scheduled minutes. - - List`1[Int32] - - - ScheduleTimeZone - - The time zone of the schedule. - - String - Rules @@ -5165,6 +5968,41 @@ Unit : Count String + + RecurrenceFrequency + + The frequency of recurrence. The allowed values are: None, Second, Minute, Hour, Day, Week, Month, Year. Not all those values are supported. + + RecurrenceFrequency + + + ScheduleDays + + A list of days scheduled. + + List`1[String] + + + ScheduleHours + + A list of scheduled hours. + + List`1[Int32] + + + ScheduleMinutes + + List of scheduled minutes. + + List`1[Int32] + + + ScheduleTimeZone + + The time zone of the schedule. + + String + Rules @@ -5230,58 +6068,58 @@ Unit : Count - - RecurrenceFrequency + + Rules - The frequency of recurrence. The allowed values are: None, Second, Minute, Hour, Day, Week, Month, Year. Not all those values are supported. + The list of rules to add to the newly created profile. - RecurrenceFrequency + List`1[ScaleRule] - RecurrenceFrequency + List`1[ScaleRule] - - ScheduleDays + + Profile - A list of days scheduled. + In-memory profile (AzureProfile). - List`1[String] + AzureProfile - List`1[String] + AzureProfile - - ScheduleHours + + StartTimeWindow - A list of scheduled hours. + The start of the time window. - List`1[Int32] + DateTime - List`1[Int32] + DateTime - - ScheduleMinutes + + EndTimeWindow - List of scheduled minutes. + The end of the time window. - List`1[Int32] + DateTime - List`1[Int32] + DateTime - ScheduleTimeZone + TimeWindowTimeZone - The time zone of the schedule. + The time zone of the time window. String @@ -5290,58 +6128,58 @@ Unit : Count - - Rules + + RecurrenceFrequency - The list of rules to add to the newly created profile. + The frequency of recurrence. The allowed values are: None, Second, Minute, Hour, Day, Week, Month, Year. Not all those values are supported. - List`1[ScaleRule] + RecurrenceFrequency - List`1[ScaleRule] + RecurrenceFrequency - - Profile + + ScheduleDays - In-memory profile (AzureProfile). + A list of days scheduled. - AzureProfile + List`1[String] - AzureProfile + List`1[String] - - StartTimeWindow + + ScheduleHours - The start of the time window. + A list of scheduled hours. - DateTime + List`1[Int32] - DateTime + List`1[Int32] - - EndTimeWindow + + ScheduleMinutes - The end of the time window. + List of scheduled minutes. - DateTime + List`1[Int32] - DateTime + List`1[Int32] - TimeWindowTimeZone + ScheduleTimeZone - The time zone of the time window. + The time zone of the schedule. String @@ -5534,10 +6372,6 @@ $profile = new-autoscaleprofile -DefaultCapacity "1" -MaximumCapacity Get-AutoscaleHistory - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - @@ -5915,10 +6749,6 @@ Microsoft.Azure.Management.Insights.Models.MetricTrigger Microsoft.Azure.Mana Get-AutoscaleHistory - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - @@ -6062,20 +6892,28 @@ Microsoft.Azure.Management.Insights.Models.MetricTrigger Microsoft.Azure.Mana - Add-AlertRule + Get-AlertRule + + + + Get-AlertHistory - Get-AlertRule + Add-MetricAlertRule - Get-AlertHistory + Add-EventAlertRule - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 + Add-WebtestAlertRule + + + + Unknown + @@ -6209,10 +7047,6 @@ Microsoft.Azure.Management.Insights.Models.MetricTrigger Microsoft.Azure.Mana Get-AutoscaleHistory - - Online Version: - http://go.microsoft.com/fwlink/?LinkID=397618 - - + \ No newline at end of file