diff --git a/AzurePowershell.Test.targets b/AzurePowershell.Test.targets index 934eb39a61c1..ab6484c15da1 100644 --- a/AzurePowershell.Test.targets +++ b/AzurePowershell.Test.targets @@ -50,8 +50,8 @@ Command="MSTest.exe /testcontainer:$(_testAssembly) /testsettings:$(_testSettings) /category:$(_testFilter) /resultsfile:$(_testResult)" ContinueOnError="false" /> - - + + @@ -62,7 +62,7 @@ - + @@ -85,10 +85,12 @@ - + - + + + - + @@ -37,11 +42,14 @@ $(PublishDirectory)\TestResults true http://psget/PSGallery/api/v2/ + all - - - + + + @@ -77,7 +85,7 @@ Targets="Clean" Properties="Configuration=$(Configuration);Platform=Any CPU" ContinueOnError="false" - Condition=" '$(Scope)' == '' "/> + Condition=" '$(Scope)' == 'all' "/> @@ -159,17 +167,17 @@ Targets="Build" Properties="Configuration=$(Configuration);Platform=Any CPU" ContinueOnError="false" - Condition=" '$(Scope)' == '' "/> + Condition=" '$(Scope)' == 'all' "/> + Condition=" '$(Scope)' == 'all' "/> + Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == 'all'" /> @@ -289,11 +297,10 @@ - + - - + diff --git a/setup-powershellget/Setup/ShortcutStartup.ps1 b/setup-powershellget/Setup/ShortcutStartup.ps1 index 9c5e77b44433..9d2228f0d5a6 100644 --- a/setup-powershellget/Setup/ShortcutStartup.ps1 +++ b/setup-powershellget/Setup/ShortcutStartup.ps1 @@ -17,9 +17,25 @@ Param( [switch]$Install ) +function EnsureRegistryPath +{ + $originalpaths = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PSModulePath).PSModulePath + if($originalpaths.Contains("$env:ProgramFiles\WindowsPowerShell\Modules") -eq $false) + { + Write-Output "Fixing PSModulePath" + $newPath = "$originalpaths;$env:ProgramFiles\WindowsPowerShell\Modules" + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PSModulePath –Value $newPath + } + else + { + Write-Output "PSModulePath successfuly validated" + } +} + $error.clear() try { if ($Install.IsPresent) { + EnsureRegistryPath Write-Output @" Finalizing installation of Azure PowerShell. @@ -57,4 +73,5 @@ Write-Output "An error occured during installation." Write-Output $error Write-Output "Press any key..." $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") -} \ No newline at end of file +} + diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index f5203cb8393b..641f30afefd7 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -2535,9 +2535,6 @@ - - - @@ -5164,7 +5161,6 @@ - diff --git a/src/ResourceManager/ApiManagement/ApiManagement.sln b/src/ResourceManager/ApiManagement/ApiManagement.sln index 509ae32588a3..733aa0b7732b 100644 --- a/src/ResourceManager/ApiManagement/ApiManagement.sln +++ b/src/ResourceManager/ApiManagement/ApiManagement.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +VisualStudioVersion = 12.0.40629.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{95C16AED-FD57-42A0-86C3-2CF4300A4817}" EndProject @@ -32,6 +32,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement.Common", "..\..\ServiceManagement\Common\Commands.ServiceManagement.Common\Commands.ServiceManagement.Common.csproj", "{CFF09E81-1E31-444E-B4D4-A21E946C29E2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -94,6 +96,10 @@ Global {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.Build.0 = Release|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Automation/Automation.sln b/src/ResourceManager/Automation/Automation.sln index 6ead0ee365f3..9376fc4f5b00 100644 --- a/src/ResourceManager/Automation/Automation.sln +++ b/src/ResourceManager/Automation/Automation.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Prof EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.ResourceManager.Common", "..\Common\Commands.ScenarioTests.ResourceManager.Common\Commands.ScenarioTests.ResourceManager.Common.csproj", "{3436A126-EDC9-4060-8952-9A1BE34CDD95}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,6 +42,10 @@ Global {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Debug|Any CPU.Build.0 = Debug|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.ActiveCfg = Release|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/AzureBackup/AzureBackup.sln b/src/ResourceManager/AzureBackup/AzureBackup.sln index f51f6f155112..287471331331 100644 --- a/src/ResourceManager/AzureBackup/AzureBackup.sln +++ b/src/ResourceManager/AzureBackup/AzureBackup.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,6 +42,10 @@ Global {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/AzureBatch/AzureBatch.sln b/src/ResourceManager/AzureBatch/AzureBatch.sln index 9c364d137071..344a94efde20 100644 --- a/src/ResourceManager/AzureBatch/AzureBatch.sln +++ b/src/ResourceManager/AzureBatch/AzureBatch.sln @@ -18,6 +18,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources", "..\Re EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", "..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj", "{8058D403-06E3-4BED-8924-D166CE303961}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -52,6 +56,14 @@ Global {8058D403-06E3-4BED-8924-D166CE303961}.Debug|Any CPU.Build.0 = Debug|Any CPU {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.ActiveCfg = Release|Any CPU {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Compute/Compute.sln b/src/ResourceManager/Compute/Compute.sln index 11bb5e5e40b6..4675b38ccd59 100644 --- a/src/ResourceManager/Compute/Compute.sln +++ b/src/ResourceManager/Compute/Compute.sln @@ -34,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "..\..\Common\Storage\Commands.Storage\Commands.Storage.csproj", "{08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement.Common", "..\..\ServiceManagement\Common\Commands.ServiceManagement.Common\Commands.ServiceManagement.Common.csproj", "{CFF09E81-1E31-444E-B4D4-A21E946C29E2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -100,6 +102,10 @@ Global {08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}.Debug|Any CPU.Build.0 = Debug|Any CPU {08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}.Release|Any CPU.ActiveCfg = Release|Any CPU {08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}.Release|Any CPU.Build.0 = Release|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/DataFactories/DataFactories.sln b/src/ResourceManager/DataFactories/DataFactories.sln index 5c206b6c79a6..776515232269 100644 --- a/src/ResourceManager/DataFactories/DataFactories.sln +++ b/src/ResourceManager/DataFactories/DataFactories.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources", "..\Re EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", "..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj", "{8058D403-06E3-4BED-8924-D166CE303961}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {8058D403-06E3-4BED-8924-D166CE303961}.Debug|Any CPU.Build.0 = Debug|Any CPU {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.ActiveCfg = Release|Any CPU {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.Build.0 = Release|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Dns/Dns.sln b/src/ResourceManager/Dns/Dns.sln index b9a2ce6145e8..51bb234e88d0 100644 --- a/src/ResourceManager/Dns/Dns.sln +++ b/src/ResourceManager/Dns/Dns.sln @@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Dns.Test", "Commands.Dns.Test\Commands.Dns.Test.csproj", "{133561EC-99AF-4ADC-AF41-39C4D3AD323B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,6 +60,10 @@ Global {133561EC-99AF-4ADC-AF41-39C4D3AD323B}.Debug|Any CPU.Build.0 = Debug|Any CPU {133561EC-99AF-4ADC-AF41-39C4D3AD323B}.Release|Any CPU.ActiveCfg = Release|Any CPU {133561EC-99AF-4ADC-AF41-39C4D3AD323B}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/HDInsight/HDInsight.sln b/src/ResourceManager/HDInsight/HDInsight.sln index 242437eea50a..b014fe0664c9 100644 --- a/src/ResourceManager/HDInsight/HDInsight.sln +++ b/src/ResourceManager/HDInsight/HDInsight.sln @@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,6 +60,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE 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 diff --git a/src/ResourceManager/Insights/Insights.sln b/src/ResourceManager/Insights/Insights.sln index 14804839b33f..36d29f50e21d 100644 --- a/src/ResourceManager/Insights/Insights.sln +++ b/src/ResourceManager/Insights/Insights.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,6 +42,10 @@ Global {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/KeyVault/KeyVault.sln b/src/ResourceManager/KeyVault/KeyVault.sln index 312a9f3fe52c..d0026ceedd50 100644 --- a/src/ResourceManager/KeyVault/KeyVault.sln +++ b/src/ResourceManager/KeyVault/KeyVault.sln @@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,6 +60,10 @@ Global {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Network/Network.sln b/src/ResourceManager/Network/Network.sln index c351f2c5f7fb..828d39e9f320 100644 --- a/src/ResourceManager/Network/Network.sln +++ b/src/ResourceManager/Network/Network.sln @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,10 @@ Global {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/OperationalInsights/OperationalInsights.sln b/src/ResourceManager/OperationalInsights/OperationalInsights.sln index 6e6226bf7a44..627df9cc0c04 100644 --- a/src/ResourceManager/OperationalInsights/OperationalInsights.sln +++ b/src/ResourceManager/OperationalInsights/OperationalInsights.sln @@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,6 +60,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Profile/Profile.sln b/src/ResourceManager/Profile/Profile.sln index 0689f47ced3b..eeb568975b82 100644 --- a/src/ResourceManager/Profile/Profile.sln +++ b/src/ResourceManager/Profile/Profile.sln @@ -12,6 +12,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile.Test", "Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.ResourceManager.Common", "..\Common\Commands.ScenarioTests.ResourceManager.Common\Commands.ScenarioTests.ResourceManager.Common.csproj", "{3436A126-EDC9-4060-8952-9A1BE34CDD95}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -34,6 +36,10 @@ Global {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Debug|Any CPU.Build.0 = Debug|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.ActiveCfg = Release|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTests.cs b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTests.cs index 8fd5f15be630..a9e7402532d9 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTests.cs +++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTests.cs @@ -47,5 +47,12 @@ public void TestSetRedisCacheBugFixTest() { RunPowerShellTest("Test-SetRedisCacheBugFixTest"); } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestMaxMemoryPolicyErrorCheck() + { + RunPowerShellTest("Test-MaxMemoryPolicyErrorCheck"); + } } } diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTests.ps1 b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTests.ps1 index ea4bdc4dcf75..7ee5023a6878 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTests.ps1 +++ b/src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/RedisCacheTests.ps1 @@ -258,4 +258,20 @@ function Test-SetRedisCacheBugFixTest $cacheUpdated2 = Set-AzureRmRedisCache -ResourceGroupName $resourceGroupName -Name $cacheName -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"} Assert-AreEqual "allkeys-lru" $cacheUpdated2.RedisConfiguration.Item("maxmemory-policy") Assert-True { $cacheUpdated2.EnableNonSslPort } +} + +<# +.SYNOPSIS +Tests MaxMemoryPolicy error check +#> +function Test-MaxMemoryPolicyErrorCheck +{ + # Setup + # resource group should exists + $resourceGroupName = "DummyResourceGroup" + $cacheName = "dummycache" + $location = "North Central US" + + # Updating Cache + Assert-ThrowsContains {New-AzureRMRedisCache -ResourceGroupName $resourceGroupName -Name $cacheName -Location $location -MaxMemoryPolicy AllKeysRandom} "The 'MaxMemoryPolicy' setting has been deprecated" } \ No newline at end of file diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands/NewAzureRedisCache.cs b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands/NewAzureRedisCache.cs index cca419c5d864..c852ea18269b 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands/NewAzureRedisCache.cs +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands/NewAzureRedisCache.cs @@ -22,6 +22,7 @@ namespace Microsoft.Azure.Commands.RedisCache using SkuStrings = Microsoft.Azure.Management.Redis.Models.SkuName; using Hyak.Common; using System.Collections; + using System; [Cmdlet(VerbsCommon.New, "AzureRmRedisCache"), OutputType(typeof(RedisCacheAttributesWithAccessKeys))] public class NewAzureRedisCache : RedisCacheCmdletBase @@ -50,6 +51,9 @@ public class NewAzureRedisCache : RedisCacheCmdletBase [ValidateSet(SkuStrings.Basic, SkuStrings.Standard, IgnoreCase = false)] public string Sku { get; set; } + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false, HelpMessage = "MaxMemoryPolicy is deprecated. Please use RedisConfiguration instead.")] + public string MaxMemoryPolicy { get; set; } + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false, HelpMessage = "A hash table which represents redis configuration properties.")] public Hashtable RedisConfiguration { get; set; } @@ -65,6 +69,11 @@ protected override void ProcessRecord() WriteWarning("The RedisVersion parameter has been deprecated. As such, it is no longer necessary to provide this parameter and any value specified is ignored."); } + if (!string.IsNullOrEmpty(MaxMemoryPolicy)) + { + throw new ArgumentException(Resources.MaxMemoryPolicyException); + } + string skuFamily; int skuCapacity = 1; diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands/SetAzureRedisCache.cs b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands/SetAzureRedisCache.cs index f4d1e2f84fd8..a73e8f0d58e7 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Commands/SetAzureRedisCache.cs +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Commands/SetAzureRedisCache.cs @@ -15,11 +15,14 @@ namespace Microsoft.Azure.Commands.RedisCache { using Microsoft.Azure.Commands.RedisCache.Models; + using Microsoft.Azure.Commands.RedisCache.Properties; using Microsoft.Azure.Management.Redis.Models; using System.Collections; using System.Management.Automation; using SkuStrings = Microsoft.Azure.Management.Redis.Models.SkuName; - + using Hyak.Common; + using System; + [Cmdlet(VerbsCommon.Set, "AzureRmRedisCache", DefaultParameterSetName = MaxMemoryParameterSetName), OutputType(typeof(RedisCacheAttributesWithAccessKeys))] public class SetAzureRedisCache : RedisCacheCmdletBase { @@ -42,6 +45,9 @@ public class SetAzureRedisCache : RedisCacheCmdletBase [ValidateSet(SkuStrings.Basic, SkuStrings.Standard, IgnoreCase = false)] public string Sku { get; set; } + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false, HelpMessage = "MaxMemoryPolicy is deprecated. Please use RedisConfiguration instead.")] + public string MaxMemoryPolicy { get; set; } + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false, HelpMessage = "A hash table which represents redis configuration properties.")] public Hashtable RedisConfiguration { get; set; } @@ -50,6 +56,11 @@ public class SetAzureRedisCache : RedisCacheCmdletBase protected override void ProcessRecord() { + if (!string.IsNullOrEmpty(MaxMemoryPolicy)) + { + throw new ArgumentException(Resources.MaxMemoryPolicyException); + } + RedisGetResponse response = CacheClient.GetCache(ResourceGroupName, Name); string skuName; diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Microsoft.Azure.Commands.RedisCache.dll-Help.xml b/src/ResourceManager/RedisCache/Commands.RedisCache/Microsoft.Azure.Commands.RedisCache.dll-Help.xml index 7d0a776fdbee..65154c2edc2f 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Microsoft.Azure.Commands.RedisCache.dll-Help.xml +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Microsoft.Azure.Commands.RedisCache.dll-Help.xml @@ -316,6 +316,13 @@ String + + MaxMemoryPolicy + + The 'MaxMemoryPolicy' setting has been deprecated. Please use 'RedisConfiguration' setting to set MaxMemoryPolicy. e.g. -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"} + + String + RedisConfiguration @@ -408,6 +415,18 @@ Standard + + MaxMemoryPolicy + + The 'MaxMemoryPolicy' setting has been deprecated. Please use 'RedisConfiguration' setting to set MaxMemoryPolicy. e.g. -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"} + + String + + String + + + + RedisConfiguration @@ -1088,6 +1107,13 @@ String + + MaxMemoryPolicy + + The 'MaxMemoryPolicy' setting has been deprecated. Please use 'RedisConfiguration' setting to set MaxMemoryPolicy. e.g. -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"} + + String + RedisConfiguration @@ -1155,6 +1181,18 @@ + + MaxMemoryPolicy + + The 'MaxMemoryPolicy' setting has been deprecated. Please use 'RedisConfiguration' setting to set MaxMemoryPolicy. e.g. -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"} + + String + + String + + + + RedisConfiguration diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Properties/Resources.Designer.cs b/src/ResourceManager/RedisCache/Commands.RedisCache/Properties/Resources.Designer.cs index 504ce90ddea9..dd9cdd59e67b 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Properties/Resources.Designer.cs +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34014 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -60,6 +60,15 @@ internal Resources() { } } + /// + /// Looks up a localized string similar to The 'MaxMemoryPolicy' setting has been deprecated. Please use 'RedisConfiguration' setting to set MaxMemoryPolicy. e.g. -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"}. + /// + internal static string MaxMemoryPolicyException { + get { + return ResourceManager.GetString("MaxMemoryPolicyException", resourceCulture); + } + } + /// /// Looks up a localized string similar to Redis cache with name '{0}' already exists.. /// diff --git a/src/ResourceManager/RedisCache/Commands.RedisCache/Properties/Resources.resx b/src/ResourceManager/RedisCache/Commands.RedisCache/Properties/Resources.resx index 9535144c625c..e5ab2b9bd9d6 100644 --- a/src/ResourceManager/RedisCache/Commands.RedisCache/Properties/Resources.resx +++ b/src/ResourceManager/RedisCache/Commands.RedisCache/Properties/Resources.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + The 'MaxMemoryPolicy' setting has been deprecated. Please use 'RedisConfiguration' setting to set MaxMemoryPolicy. e.g. -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"} + Redis cache with name '{0}' already exists. diff --git a/src/ResourceManager/RedisCache/RedisCache.sln b/src/ResourceManager/RedisCache/RedisCache.sln index c1a0b9ceea01..0f8569262a39 100644 --- a/src/ResourceManager/RedisCache/RedisCache.sln +++ b/src/ResourceManager/RedisCache/RedisCache.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Prof EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.ResourceManager.Common", "..\Common\Commands.ScenarioTests.ResourceManager.Common\Commands.ScenarioTests.ResourceManager.Common.csproj", "{3436A126-EDC9-4060-8952-9A1BE34CDD95}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,6 +42,10 @@ Global {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Debug|Any CPU.Build.0 = Debug|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.ActiveCfg = Release|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj index f16b165c9807..5b002cf6738b 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj @@ -120,6 +120,7 @@ + diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/Resource.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/Resource.cs index dbe87b7521d0..777e0354038a 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/Resource.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/Resource.cs @@ -47,6 +47,13 @@ public class Resource [JsonProperty(Required = Required.Default)] public string Type { get; set; } + /// + /// Gets or sets the resource sku. + /// + [JsonProperty(Required = Required.Default)] + public ResourceSku Sku { get; set; } + + /// /// Gets or sets the kind of the resource definition. /// diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/ResourceSku.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/ResourceSku.cs new file mode 100644 index 000000000000..ae79227e562d --- /dev/null +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/ResourceSku.cs @@ -0,0 +1,55 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Resources +{ + using Newtonsoft.Json; + + /// + /// The resource sku object. + /// + public class ResourceSku + { + /// + /// Gets or sets the sku name. + /// + [JsonProperty(Required = Required.Always)] + public string Name { get; set; } + + /// + /// Gets or sets the sku tier. + /// + [JsonProperty(Required = Required.Default)] + public string Tier { get; set; } + + /// + /// Gets or sets the sku size. + /// + [JsonProperty(Required = Required.Default)] + public string Size { get; set; } + + /// + /// Gets or sets the sku family. + /// + [JsonProperty(Required = Required.Default)] + public string Family { get; set; } + + /// + /// Gets or sets the sku capacity. + /// + [JsonProperty(Required = Required.Default)] + public int? Capacity { get; set; } + } +} + diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs index 1f858d190f69..4bc018559ad3 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs @@ -76,7 +76,7 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase /// Gets or sets the resource name parameter. /// [Alias("Id")] - [Parameter(ParameterSetName = GetAzureResourceCmdlet.GetResourceByIdParameterSet, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource's Id.")] + [Parameter(ParameterSetName = GetAzureResourceCmdlet.GetResourceByIdParameterSet, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource's Id.")] [ValidateNotNullOrEmpty] public string ResourceId { get; set; } diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceLockCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceLockCmdlet.cs index e8ee28eb24d0..7ea4243ee2a1 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceLockCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceLockCmdlet.cs @@ -30,12 +30,12 @@ public class GetAzureResourceLockCmdlet : ResourceLockManagementCmdletBase /// Gets or sets the extension resource name parameter. /// [Alias("ExtensionResourceName")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ScopeLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ScopeLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] [ValidateNotNullOrEmpty] public string LockName { get; set; } diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs index 20ae91629c14..ab8ce0bf43c1 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs @@ -60,6 +60,14 @@ public sealed class NewAzureResourceCmdlet : ResourceManipulationCmdletBase [ValidateNotNullOrEmpty] public Hashtable PlanObject { get; set; } + /// + /// Gets or sets the plan object. + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "A hash table which represents sku properties.")] + [ValidateNotNullOrEmpty] + public Hashtable SkuObject { get; set; } + + /// /// Gets or sets the tags. /// @@ -174,6 +182,7 @@ private Resource GetResource() Location = this.Location, Kind = this.Kind, Plan = this.PlanObject.ToDictionary(addValueLayer: false).ToJson().FromJson(), + Sku = this.SkuObject.ToDictionary(addValueLayer: false).ToJson().FromJson(), Tags = TagsHelper.GetTagsDictionary(this.Tag), Properties = this.Properties.ToResourcePropertiesBody(), }; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceLockCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceLockCmdlet.cs index 2fb062f0d08e..e34656e57e10 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceLockCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceLockCmdlet.cs @@ -29,12 +29,12 @@ public class NewAzureResourceLockCmdlet : ResourceLockManagementCmdletBase /// Gets or sets the extension resource name parameter. /// [Alias("ExtensionResourceName")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ScopeLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ScopeLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] [ValidateNotNullOrEmpty] public string LockName { get; set; } @@ -42,7 +42,7 @@ public class NewAzureResourceLockCmdlet : ResourceLockManagementCmdletBase /// Gets or sets the extension resource name parameter. /// [Alias("Level")] - [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The level of the lock.")] + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The level of the lock.")] [ValidateNotNullOrEmpty] public LockLevel LockLevel { get; set; } @@ -50,7 +50,7 @@ public class NewAzureResourceLockCmdlet : ResourceLockManagementCmdletBase /// Gets or sets the extension resource name parameter. /// [Alias("Notes")] - [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The notes of the lock.")] + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The notes of the lock.")] [ValidateNotNullOrEmpty] public string LockNotes { get; set; } diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/RemoveAzureResourceLockCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/RemoveAzureResourceLockCmdlet.cs index 1f4fd13dcfb0..fa749836f4f9 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/RemoveAzureResourceLockCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/RemoveAzureResourceLockCmdlet.cs @@ -27,12 +27,12 @@ public class RemoveAzureResourceLockCmdlet : ResourceLockManagementCmdletBase /// Gets or sets the extension resource name parameter. /// [Alias("ExtensionResourceName")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ScopeLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ScopeLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the lock.")] [ValidateNotNullOrEmpty] public string LockName { get; set; } diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs index 7f84ad3b9e4c..7a5e2da39c56 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs @@ -73,26 +73,26 @@ public abstract class ResourceLockManagementCmdletBase : ResourceManagerCmdletBa /// /// Gets or sets the resource name parameter. /// - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource name. e.g. to specify a database MyServer/MyDatabase.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource name. e.g. to specify a database MyServer/MyDatabase.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource name. e.g. to specify a database MyServer/MyDatabase.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource name. e.g. to specify a database MyServer/MyDatabase.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource name. e.g. to specify a database MyServer/MyDatabase.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource name. e.g. to specify a database MyServer/MyDatabase.")] [ValidateNotNullOrEmpty] public string ResourceName { get; set; } /// /// Gets or sets the resource type parameter. /// - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource type. e.g. Microsoft.Sql/Servers/Databases.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource type. e.g. Microsoft.Sql/Servers/Databases.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource type. e.g. Microsoft.Sql/Servers/Databases.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource type. e.g. Microsoft.Sql/Servers/Databases.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource type. e.g. Microsoft.Sql/Servers/Databases.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.TenantResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource type. e.g. Microsoft.Sql/Servers/Databases.")] [ValidateNotNullOrEmpty] public string ResourceType { get; set; } /// /// Gets or sets the resource group name parameter. /// - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource group name.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The resource group name.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")] + [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")] [ValidateNotNullOrEmpty] public string ResourceGroupName { get; set; } diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/SetAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/SetAzureResourceCmdlet.cs index e77d64b07c89..cdb94e6ff6dd 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/SetAzureResourceCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/SetAzureResourceCmdlet.cs @@ -53,6 +53,15 @@ public sealed class SetAzureResourceCmdlet : ResourceManipulationCmdletBase [ValidateNotNullOrEmpty] public Hashtable Plan { get; set; } + /// + /// Gets or sets the plan object. + /// + [Alias("SkuObject")] + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "A hash table which represents sku properties.")] + [ValidateNotNullOrEmpty] + public Hashtable Sku { get; set; } + + /// /// Gets or sets the tags. /// @@ -165,6 +174,7 @@ private JToken GetResourceBody() { Kind = this.Kind, Plan = this.Plan.ToDictionary(addValueLayer: false).ToJson().FromJson(), + Sku = this.Sku.ToDictionary(addValueLayer: false).ToJson().FromJson(), Tags = TagsHelper.GetTagsDictionary(this.Tag), Properties = this.Properties.ToResourcePropertiesBody(), }.ToJToken(); @@ -176,6 +186,7 @@ private JToken GetResourceBody() { Kind = this.Kind ?? resource.Kind, Plan = this.Plan.ToDictionary(addValueLayer: false).ToJson().FromJson() ?? resource.Plan, + Sku = this.Sku.ToDictionary(addValueLayer: false).ToJson().FromJson() ?? resource.Sku, Tags = TagsHelper.GetTagsDictionary(this.Tag) ?? resource.Tags, Location = resource.Location, Properties = this.Properties == null ? resource.Properties : this.Properties.ToResourcePropertiesBody(), @@ -194,7 +205,7 @@ private JToken GetResourceBody() /// private bool ShouldUsePatchSemantics() { - return this.UsePatchSemantics || (this.Tag != null && this.Plan == null && this.Properties == null && this.Kind == null); + return this.UsePatchSemantics || ((this.Tag != null || this.Sku != null) && this.Plan == null && this.Properties == null && this.Kind == null); } /// diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/Providers/GetAzureProviderCmdletTests.cs b/src/ResourceManager/Resources/Commands.Resources.Test/Providers/GetAzureProviderCmdletTests.cs index 8ffbce848eb0..0d71642c3283 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/Providers/GetAzureProviderCmdletTests.cs +++ b/src/ResourceManager/Resources/Commands.Resources.Test/Providers/GetAzureProviderCmdletTests.cs @@ -91,7 +91,7 @@ public void GetsResourceProviderTests() { new ProviderResourceType { - Locations = new[] {"West US", "East US"}, + Locations = new[] {"West US", "East US", "South US"}, Name = "TestResource2" } } @@ -197,6 +197,52 @@ public void GetsResourceProviderTests() this.cmdlet.ExecuteCmdlet(); this.VerifyGetCallPatternAndReset(); + + // 4. List only registered providers with location + this.cmdlet.Location = "South US"; + this.cmdlet.ListAvailable = false; + this.cmdlet.ProviderNamespace = null; + + this.commandRuntimeMock + .Setup(m => m.WriteObject(It.IsAny())) + .Callback((object obj) => + { + Assert.IsType(obj); + + var providers = (PSResourceProvider[])obj; + Assert.Equal(0, providers.Length); + }); + + this.cmdlet.ParameterSetOverride = GetAzureProviderCmdlet.ListAvailableParameterSet; + + this.cmdlet.ExecuteCmdlet(); + + this.VerifyListCallPatternAndReset(); + + // 5. List all providers + this.cmdlet.ListAvailable = true; + this.cmdlet.Location = "South US"; + this.cmdlet.ProviderNamespace = null; + + this.commandRuntimeMock + .Setup(m => m.WriteObject(It.IsAny())) + .Callback((object obj) => + { + var providers = (PSResourceProvider[])obj; + Assert.Equal(0, providers.Length); + + var provider = providers.Single(); + Assert.Equal(UnregisteredProviderNamespace, provider.ProviderNamespace); + + Assert.Equal(1, provider.ResourceTypes.Length); + + var resourceType = provider.ResourceTypes.Single(); + Assert.Equal(ResourceTypeName, resourceType.ResourceTypeName); + }); + + this.cmdlet.ExecuteCmdlet(); + + this.VerifyListCallPatternAndReset(); } /// diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourceTests.ps1 b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourceTests.ps1 index 1443513b2ef7..88612b3bb834 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourceTests.ps1 +++ b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourceTests.ps1 @@ -27,9 +27,9 @@ function Test-CreatesNewSimpleResource $resourceType = "Microsoft.Sql/servers" # Test - New-AzureRmResourceGroup -Name $rgname -Location $rglocation - $actual = New-AzureRmResource -Name $rname -Location $location -Tags @{Name = "testtag"; Value = "testval"} -ResourceGroupName $rgname -ResourceType $resourceType -PropertyObject @{"administratorLogin" = "adminuser"; "administratorLoginPassword" = "P@ssword1"} -ApiVersion $apiversion - $expected = Get-AzureRmResource -Name $rname -ResourceGroupName $rgname -ResourceType $resourceType -ApiVersion $apiversion + New-AzureRMResourceGroup -Name $rgname -Location $rglocation + $actual = New-AzureRMResource -Name $rname -Location $location -Tags @{Name = "testtag"; Value = "testval"} -ResourceGroupName $rgname -ResourceType $resourceType -PropertyObject @{"administratorLogin" = "adminuser"; "administratorLoginPassword" = "P@ssword1"} -SkuObject @{ Name = "A0" } -ApiVersion $apiversion + $expected = Get-AzureRMResource -Name $rname -ResourceGroupName $rgname -ResourceType $resourceType -ApiVersion $apiversion $list = Get-AzureRmResource -ResourceGroupName $rgname @@ -38,7 +38,8 @@ function Test-CreatesNewSimpleResource Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName Assert-AreEqual $expected.ResourceType $actual.ResourceType Assert-AreEqual 1 @($list).Count - Assert-AreEqual $expected.Name $list[0].Name + Assert-AreEqual $expected.Name $list[0].Name + Assert-AreEqual $expected.Sku $actual.Sku } <# @@ -258,12 +259,14 @@ function Test-SetAResource $resourceType = "Providers.Test/statefulResources" # Test - New-AzureRmResourceGroup -Name $rgname -Location $rglocation - $resource = New-AzureRmResource -Name $rname -Location $rglocation -Tags @{Name = "testtag"; Value = "testval"} -ResourceGroupName $rgname -ResourceType $resourceType -PropertyObject @{"key" = "value"} -ApiVersion $apiversion -Force - Set-AzureRmResource -ResourceGroupName $rgname -ResourceName $rname -ResourceType $resourceType -Properties @{"key2" = "value2"} -Force + New-AzureRMResourceGroup -Name $rgname -Location $rglocation + $resource = New-AzureRMResource -Name $rname -Location $rglocation -Tags @{Name = "testtag"; Value = "testval"} -ResourceGroupName $rgname -ResourceType $resourceType -PropertyObject @{"key" = "value"} -SkuObject @{ Name = "A0" } -ApiVersion $apiversion -Force + Set-AzureRMResource -ResourceGroupName $rgname -ResourceName $rname -ResourceType $resourceType -Properties @{"key2" = "value2"} -Force + Set-AzureRMResource -ResourceGroupName $rgname -ResourceName $rname -ResourceType $resourceType -SkuObject @{ Name = "A1" } -Force $modifiedResource = Get-AzureRmResource -ResourceGroupName $rgname -ResourceName $rname -ResourceType $resourceType # Assert Assert-AreEqual $modifiedResource.Properties.key2 "value2" + Assert-AreEqual $modifiedResource.Sku.Name "A1" } \ No newline at end of file diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/PSResourceProvider.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/PSResourceProvider.cs index 5e539bfb53c9..ef8cbe1cd320 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/PSResourceProvider.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/PSResourceProvider.cs @@ -14,6 +14,9 @@ namespace Microsoft.Azure.Commands.Resources.Models { + using System; + using System.Linq; + /// /// Definition of a resource provider and its registration state /// @@ -33,5 +36,19 @@ public class PSResourceProvider /// Gets or sets the resource types belonging to this provider. /// public PSResourceProviderResourceType[] ResourceTypes { get; set; } + + /// + /// Gets the locations for the provider. + /// + public string[] Locations + { + get + { + return this.ResourceTypes + .SelectMany(type => type.Locations) + .Distinct(StringComparer.InvariantCultureIgnoreCase) + .ToArray(); + } + } } } diff --git a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs index 3f22f04d4a07..480df4751055 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs @@ -394,16 +394,26 @@ internal List GetResourcePermissions(ResourceIdentifier identity) return null; } - public virtual PSResourceProvider[] ListPSResourceProviders(string providerName = null) + public virtual PSResourceProvider[] ListPSResourceProviders(string providerName = null, bool listAvailable = false, string location = null) { - return this.ListResourceProviders(providerName: providerName, listAvailable: false) - .Select(provider => provider.ToPSResourceProvider()) - .ToArray(); - } + var providers = this.ListResourceProviders(providerName: providerName, listAvailable: listAvailable); - public virtual PSResourceProvider[] ListPSResourceProviders(bool listAvailable) - { - return this.ListResourceProviders(providerName: null, listAvailable: listAvailable) + if (string.IsNullOrEmpty(location)) + { + return providers + .Select(provider => provider.ToPSResourceProvider()) + .ToArray(); + } + + foreach (var provider in providers) + { + provider.ResourceTypes = provider.ResourceTypes + .Where(type => !type.Locations.Any() || this.ContainsNormalizedLocation(type.Locations.ToArray(), location)) + .ToList(); + } + + return providers + .Where(provider => provider.ResourceTypes.Any()) .Select(provider => provider.ToPSResourceProvider()) .ToArray(); } @@ -439,6 +449,16 @@ public virtual List ListResourceProviders(string providerName = null, } } + private bool ContainsNormalizedLocation(string[] locations, string location) + { + return locations.Any(existingLocation => this.NormalizeLetterOrDigitToUpperInvariant(existingLocation).Equals(this.NormalizeLetterOrDigitToUpperInvariant(location))); + } + + private string NormalizeLetterOrDigitToUpperInvariant(string value) + { + return value != null ? new string(value.Where(c => char.IsLetterOrDigit(c)).ToArray()).ToUpperInvariant() : null; + } + private bool IsProviderRegistered(Provider provider) { return string.Equals( diff --git a/src/ResourceManager/Resources/Commands.Resources/Providers/GetAzureProviderCmdlet.cs b/src/ResourceManager/Resources/Commands.Resources/Providers/GetAzureProviderCmdlet.cs index 3dd256c5c3db..741a6fc7c53e 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Providers/GetAzureProviderCmdlet.cs +++ b/src/ResourceManager/Resources/Commands.Resources/Providers/GetAzureProviderCmdlet.cs @@ -15,6 +15,7 @@ namespace Microsoft.Azure.Commands.Providers { using System; + using System.Linq; using System.Management.Automation; using Microsoft.Azure.Commands.Resources.Models; @@ -41,6 +42,13 @@ public class GetAzureProviderCmdlet : ResourcesBaseCmdlet [ValidateNotNullOrEmpty] public string ProviderNamespace { get; set; } + /// + /// Gets or sets the provider namespace + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The location to look for provider namespace.")] + [ValidateNotNullOrEmpty] + public string Location { get; set; } + /// /// Gets or sets a value indicating if unregistered providers should be included in the listing /// @@ -52,20 +60,34 @@ public class GetAzureProviderCmdlet : ResourcesBaseCmdlet /// protected override void ProcessRecord() { - var parameterSetName = this.DetermineParameterSetName(); + var providers = this.ResourcesClient.ListPSResourceProviders(providerName: this.ProviderNamespace, listAvailable: this.ListAvailable, location: this.Location); - switch (parameterSetName) + if (!string.IsNullOrEmpty(this.ProviderNamespace)) { - case GetAzureProviderCmdlet.IndividualProviderParameterSet: - this.WriteObject(this.ResourcesClient.ListPSResourceProviders(providerName: this.ProviderNamespace), enumerateCollection: true); - break; - - case GetAzureProviderCmdlet.ListAvailableParameterSet: - this.WriteObject(this.ResourcesClient.ListPSResourceProviders(listAvailable: this.ListAvailable), enumerateCollection: true); - break; + var expandedProviders = providers + .SelectMany(provider => + provider.ResourceTypes + .Select(type => + new PSResourceProvider + { + ProviderNamespace = provider.ProviderNamespace, + RegistrationState = provider.RegistrationState, + ResourceTypes = new[] + { + new PSResourceProviderResourceType + { + ResourceTypeName = type.ResourceTypeName, + Locations = type.Locations, + ApiVersions = type.ApiVersions, + } + } + })); - default: - throw new ApplicationException(string.Format("Unknown parameter set encountered: '{0}'", this.ParameterSetName)); + this.WriteObject(expandedProviders, enumerateCollection: true); + } + else + { + this.WriteObject(providers, enumerateCollection: true); } } } diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs index a6ef20f6f731..1fcfda56a2ef 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs @@ -33,7 +33,7 @@ public class GetAzureResourceGroupDeploymentCommand : ResourcesBaseCmdlet [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The provisioning state of the resource group deployment.")] + [Parameter(Mandatory = false, HelpMessage = "The provisioning state of the resource group deployment.")] [ValidateNotNullOrEmpty] public string ProvisioningState { get; set; } diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommand.cs index 6c2cb4ca451f..962a9be5c661 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommand.cs @@ -33,10 +33,10 @@ public class RemoveAzureResourceGroupDeploymentCommand : ResourcesBaseCmdlet [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Do not confirm the remove.")] + [Parameter(Mandatory = false, HelpMessage = "Do not confirm the remove.")] public SwitchParameter Force { get; set; } - [Parameter(Position = 3, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "True if succeed, false otherwise.")] + [Parameter(Mandatory = false, HelpMessage = "True if succeed, false otherwise.")] public SwitchParameter PassThru { get; set; } protected override void ProcessRecord() diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommand.cs index 96eb42dde0a1..ea39ebf3213e 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommand.cs @@ -33,10 +33,10 @@ public class StopAzureResourceGroupDeploymentCommand : ResourcesBaseCmdlet [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Do not confirm the stop.")] + [Parameter(Mandatory = false, HelpMessage = "Do not confirm the stop.")] public SwitchParameter Force { get; set; } - [Parameter(Position = 3, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "True if succeed, false otherwise.")] + [Parameter(Mandatory = false, HelpMessage = "True if succeed, false otherwise.")] public SwitchParameter PassThru { get; set; } protected override void ProcessRecord() diff --git a/src/ResourceManager/Resources/Resources.sln b/src/ResourceManager/Resources/Resources.sln index 66039cf34c54..8fb07dab530d 100644 --- a/src/ResourceManager/Resources/Resources.sln +++ b/src/ResourceManager/Resources/Resources.sln @@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -52,6 +54,10 @@ Global {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/SiteRecovery/SiteRecovery.sln b/src/ResourceManager/SiteRecovery/SiteRecovery.sln index bfeae087f99c..2136cd6804f0 100644 --- a/src/ResourceManager/SiteRecovery/SiteRecovery.sln +++ b/src/ResourceManager/SiteRecovery/SiteRecovery.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,6 +42,10 @@ Global {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Sql/Sql.sln b/src/ResourceManager/Sql/Sql.sln index 3219786c5e1d..8dcf5b48785b 100644 --- a/src/ResourceManager/Sql/Sql.sln +++ b/src/ResourceManager/Sql/Sql.sln @@ -30,6 +30,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Insights", "..\Insights\Commands.Insights\Commands.Insights.csproj", "{DEA446A1-84E2-46CC-B780-EB4AFDE2460E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement.Common", "..\..\ServiceManagement\Common\Commands.ServiceManagement.Common\Commands.ServiceManagement.Common.csproj", "{CFF09E81-1E31-444E-B4D4-A21E946C29E2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -88,6 +90,10 @@ Global {DEA446A1-84E2-46CC-B780-EB4AFDE2460E}.Debug|Any CPU.Build.0 = Debug|Any CPU {DEA446A1-84E2-46CC-B780-EB4AFDE2460E}.Release|Any CPU.ActiveCfg = Release|Any CPU {DEA446A1-84E2-46CC-B780-EB4AFDE2460E}.Release|Any CPU.Build.0 = Release|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Storage/Storage.sln b/src/ResourceManager/Storage/Storage.sln index ae60ddee819c..7af18caf0872 100644 --- a/src/ResourceManager/Storage/Storage.sln +++ b/src/ResourceManager/Storage/Storage.sln @@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "..\..\Common\Storage\Commands.Storage\Commands.Storage.csproj", "{08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement.Common", "..\..\ServiceManagement\Common\Commands.ServiceManagement.Common\Commands.ServiceManagement.Common.csproj", "{CFF09E81-1E31-444E-B4D4-A21E946C29E2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -26,6 +28,10 @@ Global {08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}.Debug|Any CPU.Build.0 = Debug|Any CPU {08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}.Release|Any CPU.ActiveCfg = Release|Any CPU {08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}.Release|Any CPU.Build.0 = Release|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Tags/Tags.sln b/src/ResourceManager/Tags/Tags.sln index 9bf51fbfe0e2..d4527bd8a3d9 100644 --- a/src/ResourceManager/Tags/Tags.sln +++ b/src/ResourceManager/Tags/Tags.sln @@ -6,6 +6,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ResourceManager.Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -20,6 +22,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/TrafficManager/TrafficManager.sln b/src/ResourceManager/TrafficManager/TrafficManager.sln index a54f92b7ffb0..86bd2ca81848 100644 --- a/src/ResourceManager/TrafficManager/TrafficManager.sln +++ b/src/ResourceManager/TrafficManager/TrafficManager.sln @@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources", "..\Re EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", "..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj", "{8058D403-06E3-4BED-8924-D166CE303961}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,6 +60,10 @@ Global {8058D403-06E3-4BED-8924-D166CE303961}.Debug|Any CPU.Build.0 = Debug|Any CPU {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.ActiveCfg = Release|Any CPU {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/UsageAggregates/UsageAggregates.sln b/src/ResourceManager/UsageAggregates/UsageAggregates.sln index e55a5c9266bb..1f0626abd5e7 100644 --- a/src/ResourceManager/UsageAggregates/UsageAggregates.sln +++ b/src/ResourceManager/UsageAggregates/UsageAggregates.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,6 +42,10 @@ Global {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ResourceManager/Websites/WebSites.sln b/src/ResourceManager/Websites/WebSites.sln index 62ffa02e0f9a..e9c3057d83e7 100644 --- a/src/ResourceManager/Websites/WebSites.sln +++ b/src/ResourceManager/Websites/WebSites.sln @@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,6 +60,10 @@ Global {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tools/AzureRM/AzureRM.psd1 b/tools/AzureRM/AzureRM.psd1 index 740ba03a61cb..51fd7597bf01 100644 Binary files a/tools/AzureRM/AzureRM.psd1 and b/tools/AzureRM/AzureRM.psd1 differ diff --git a/tools/AzureRM/AzureRM.psm1 b/tools/AzureRM/AzureRM.psm1 index 0f61bd8f478b..f28ba6e28a7a 100644 --- a/tools/AzureRM/AzureRM.psm1 +++ b/tools/AzureRM/AzureRM.psm1 @@ -1,9 +1,6 @@ -#Requires -RunAsAdministrator - $AzureRMProfileVersion = "0.9.8"; $AzureRMModules = @{ - "Azure.Storage" = "0.9.8"; "AzureRM.ApiManagement" = "0.9.8"; "AzureRM.Automation" = "0.9.8"; "AzureRM.Backup" = "0.9.8"; @@ -16,7 +13,6 @@ $AzureRMModules = @{ "AzureRM.KeyVault" = "0.9.8"; "AzureRM.Network" = "0.9.8"; "AzureRM.OperationalInsights" = "0.9.8"; - "AzureRM.Profile" = "0.9.8"; "AzureRM.RedisCache" = "0.9.8"; "AzureRM.Resources" = "0.9.8"; "AzureRM.SiteRecovery" = "0.9.8"; @@ -29,6 +25,19 @@ $AzureRMModules = @{ "AzureRM.Websites" = "0.9.8" } +function Validate-AdminRights([string]$Scope) +{ + if ($Scope -ne "CurrentUser") + { + $user = [Security.Principal.WindowsIdentity]::GetCurrent(); + $isAdmin = (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) + if($isAdmin -eq $false) + { + throw "Administrator rights are required to install Microsoft Azure modules" + } + } +} + function Import-ModuleWithVersionCheck([string]$Name,[string]$MinimumVersion,[string]$Repository,[string]$Scope) { $minVer = $MinimumVersion @@ -77,6 +86,8 @@ function Update-AzureRM $Scope = "AllUsers" } + Validate-AdminRights $Scope + Write-Output "Installing AzureRM modules." Import-ModuleWithVersionCheck "AzureRM.Profile" $AzureRMProfileVersion $Repository $Scope @@ -103,18 +114,24 @@ function Uninstall-AzureRM [string] $Repository) + Validate-AdminRights "AllUsers" + Write-Output "Uninstalling AzureRM modules." $AzureRMModules.Keys | ForEach { $moduleName = $_ if ((Get-InstalledModule | where {$_.Name -eq $moduleName}) -ne $null) { - Uninstall-Module -Name $_ -ErrorAction Stop + $minVer = $AzureRMModules[$_] + $maxVer = "$($minVer.Split(".")[0]).9999.0" + Uninstall-Module -Name $_ -MinimumVersion $minVer -MaximumVersion $maxVer -ErrorAction Stop Write-Output "$moduleName uninstalled..." } } - if ((Get-InstalledModule | where {"AzureRM.Profile" -eq $moduleName}) -ne $null) { - Uninstall-Module -Name "AzureRM.Profile" -ErrorAction Stop + if ((Get-InstalledModule | where {$_.Name -eq "AzureRM.Profile"}) -ne $null) { + $minVer = $AzureRMProfileVersion + $maxVer = "$($minVer.Split(".")[0]).9999.0" + Uninstall-Module -Name "AzureRM.Profile" -MinimumVersion $minVer -MaximumVersion $maxVer -ErrorAction Stop Write-Output "AzureRM.Profile uninstalled..." } } diff --git a/tools/PublishModules.ps1 b/tools/PublishModules.ps1 index bd21b1daf213..ed09c5844e34 100644 --- a/tools/PublishModules.ps1 +++ b/tools/PublishModules.ps1 @@ -38,7 +38,7 @@ if ([string]::IsNullOrEmpty($repositoryLocation)) if ([string]::IsNullOrEmpty($scope)) { Write-Verbose "Default scope to all" - $scope = 'all' + $scope = 'All' } Write-Host "Publishing $scope package(s)" @@ -53,10 +53,26 @@ if ($repo -ne $null) { Register-PSRepository -Name $repoName -SourceLocation $repositoryLocation -PublishLocation $repositoryLocation/package -InstallationPolicy Trusted } -if (($scope -eq 'all') -or ($scope -eq 'servicemanagement')) { +$resourceManagerRootFolder = "$packageFolder\$buildConfig\ResourceManager\AzureResourceManager" + +if ($scope -eq 'All') { + # Publish AzureRM.Profile first which is the common dependency + Write-Host "Publishing profile module" + Publish-Module -Path "$resourceManagerRootFolder\AzureRM.Profile" -NuGetApiKey $apiKey -Repository $repoName + Write-Host "Published profile module" +} + +if (($scope -eq 'All') -or ($scope -eq 'ServiceManagement')) { $modulePath = "$packageFolder\$buildConfig\ServiceManagement\Azure" # Publish Azure module - Write-Host "Publishing Azure module from $modulePath" + Write-Host "Publishing ServiceManagement(aka Azure) module from $modulePath" + Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName +} + +if (($scope -eq 'All') -or ($scope -eq 'AzureStorage')) { + $modulePath = "$packageFolder\$buildConfig\ServiceManagement\Azure\Azure.Storage" + # Publish AzureStorage module + Write-Host "Publishing AzureStorage module from $modulePath" Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName } @@ -68,15 +84,17 @@ if ($scope -eq 'AzureRM') { Write-Host "Published Azure module" } -$resourceManagerRootFolder = "$packageFolder\$buildConfig\ResourceManager\AzureResourceManager" $resourceManagerModules = Get-ChildItem -Path $resourceManagerRootFolder -Directory -if ($scope -eq 'all') { - # Publish AzureRM modules +if ($scope -eq 'All') { foreach ($module in $resourceManagerModules) { - $modulePath = $module.FullName - Write-Host "Publishing $module module from $modulePath" - Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName - Write-Host "Published $module module" + # filter out AzureRM.Profile which always gets published first + # And "Azure.Storage" which is built out as test dependencies + if (($module.Name -ne "AzureRM.Profile") -and ($module.Name -ne "Azure.Storage")) { + $modulePath = $module.FullName + Write-Host "Publishing $module module from $modulePath" + Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName + Write-Host "Published $module module" + } } } else { $modulePath = Join-Path $resourceManagerRootFolder "AzureRM.$scope"