From 0a53a4955bd888e4320cc076c91a30f067c1a0bd Mon Sep 17 00:00:00 2001 From: markcowl Date: Wed, 7 Oct 2015 16:46:35 -0700 Subject: [PATCH 01/17] Add back removed resourcemanager startups cript --- .../GetAzureResourceGroupCommand.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs index 1b1bc0c7925f..4de3b4d03ea1 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs @@ -14,7 +14,10 @@ using Microsoft.Azure.Commands.Resources.Models; using System.Collections.Generic; +using System.IO; using System.Management.Automation; +using System.Reflection; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.Resources { @@ -22,7 +25,7 @@ namespace Microsoft.Azure.Commands.Resources /// Filters resource groups. /// [Cmdlet(VerbsCommon.Get, "AzureRmResourceGroup", DefaultParameterSetName = ResourceGroupNameParameterSet), OutputType(typeof(List))] - public class GetAzureResourceGroupCommand : ResourcesBaseCmdlet + public class GetAzureResourceGroupCommand : ResourcesBaseCmdlet, IModuleAssemblyInitializer { /// /// List resources group by name parameter set. @@ -57,5 +60,25 @@ protected override void ProcessRecord() ResourcesClient.FilterResourceGroups(name: this.Name, tag: null, detailed: false, location: this.Location), true); } + + /// + /// Load global aliases and script cmdlets for ARM + /// + public void OnImport() + { + try + { + System.Management.Automation.PowerShell invoker = null; + invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace); + invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath( + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), + "ResourceManagerStartup.ps1"))); + invoker.Invoke(); + } + catch + { + // This may throw exception for tests, ignore. + } + } } } \ No newline at end of file From 313c26eaa0dc32cb8950469cf35a100634966431 Mon Sep 17 00:00:00 2001 From: markcowl Date: Wed, 7 Oct 2015 16:55:19 -0700 Subject: [PATCH 02/17] Updating scripts for new module split --- .../ResourceManagerStartup.ps1 | 14 ----------- .../Sql/Commands.Sql/Commands.Sql.csproj | 3 +++ .../Server/Cmdlet/GetAzureSqlServer.cs | 25 ++++++++++++++++++- .../Sql/Commands.Sql/SqlStartup.ps1 | 22 ++++++++++++++++ 4 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 src/ResourceManager/Sql/Commands.Sql/SqlStartup.ps1 diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceManagerStartup.ps1 b/src/ResourceManager/Resources/Commands.Resources/ResourceManagerStartup.ps1 index bdb140883a2c..3c8c12e400ab 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceManagerStartup.ps1 +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceManagerStartup.ps1 @@ -12,20 +12,6 @@ # limitations under the License. # ---------------------------------------------------------------------------------- -@{ - # Sql aliases - "Get-AzureRmSqlDatabaseServerAuditingPolicy" = "Get-AzureRmSqlServerAuditingPolicy"; - "Remove-AzureRmSqlDatabaseServerAuditing" = "Remove-AzureRmSqlServerAuditing"; - "Set-AzureRmSqlDatabaseServerAuditingPolicy" = "Set-AzureRmSqlServerAuditingPolicy"; - "Use-AzureRmSqlDatabaseServerAuditingPolicy" = "Use-AzureRmSqlServerAuditingPolicy"; - - # Storage aliases - "Get-AzureRmStorageContainerAcl" = "Get-AzureRmStorageContainer"; - "Start-CopyAzureStorageBlob" = "Start-AzureRmStorageBlobCopy"; - "Stop-CopyAzureStorageBlob" = "Stop-AzureRmStorageBlobCopy"; -}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias" - - # Authorization script commandlet that builds on top of existing Insights comandlets. # This commandlet gets all events for the "Microsoft.Authorization" resource provider by calling the "Get-AzureRmResourceProviderLog" commandlet diff --git a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj index 8a7b9430fb63..7046ecef47c5 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj +++ b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj @@ -234,6 +234,9 @@ + + PreserveNewest + diff --git a/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs b/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs index ea570c9fc74b..7e0bebfd8d1b 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs @@ -13,8 +13,11 @@ // ---------------------------------------------------------------------------------- using System.Collections.Generic; +using System.IO; using System.Management.Automation; +using System.Reflection; using Microsoft.Azure.Commands.Sql.Server.Model; +using Microsoft.Azure.Common.Authentication; namespace Microsoft.Azure.Commands.Sql.Server.Cmdlet { @@ -22,7 +25,7 @@ namespace Microsoft.Azure.Commands.Sql.Server.Cmdlet /// Defines the Get-AzureRmSqlServer cmdlet /// [Cmdlet(VerbsCommon.Get, "AzureRmSqlServer", ConfirmImpact = ConfirmImpact.None)] - public class GetAzureSqlServer : AzureSqlServerCmdletBase + public class GetAzureSqlServer : AzureSqlServerCmdletBase, IModuleAssemblyInitializer { /// /// Gets or sets the name of the database server to use. @@ -74,5 +77,25 @@ protected override IEnumerable ApplyUserInputToModel(IEnume { return model; } + + /// + /// Add Sql aliases + /// + public void OnImport() + { + try + { + System.Management.Automation.PowerShell invoker = null; + invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace); + invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath( + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), + "SqlStartup.ps1"))); + invoker.Invoke(); + } + catch + { + // This may throw exception for tests, ignore. + } + } } } diff --git a/src/ResourceManager/Sql/Commands.Sql/SqlStartup.ps1 b/src/ResourceManager/Sql/Commands.Sql/SqlStartup.ps1 new file mode 100644 index 000000000000..d1624c618418 --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql/SqlStartup.ps1 @@ -0,0 +1,22 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +@{ + # Sql aliases + "Get-AzureRmSqlDatabaseServerAuditingPolicy" = "Get-AzureRmSqlServerAuditingPolicy"; + "Remove-AzureRmSqlDatabaseServerAuditing" = "Remove-AzureRmSqlServerAuditing"; + "Set-AzureRmSqlDatabaseServerAuditingPolicy" = "Set-AzureRmSqlServerAuditingPolicy"; + "Use-AzureRmSqlDatabaseServerAuditingPolicy" = "Use-AzureRmSqlServerAuditingPolicy"; +}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias" + From 7b53ee3f6fded83464c019d9e7dddc278fac5bc7 Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Wed, 7 Oct 2015 17:10:04 -0700 Subject: [PATCH 03/17] Fix badly named cmdlets in Profile and Keyvault --- .../Commands/AddAzureKeyVaultKey.cs | 2 +- .../Commands/BackupAzureKeyVaultKey.cs | 2 +- .../Commands/GetAzureKeyVaultKey.cs | 2 +- .../Commands/GetAzureKeyVaultSecret.cs | 2 +- .../Commands/RemoveAzureKeyVaultKey.cs | 2 +- .../Commands/RemoveAzureKeyVaultSecret.cs | 2 +- .../Commands/RestoreAzureKeyVaultKey.cs | 2 +- .../Commands/SetAzureKeyVaultKeyAttribute.cs | 2 +- .../Commands/SetAzureKeyVaultSecret.cs | 2 +- .../SetAzureKeyVaultSecretAttribute.cs | 2 +- .../Context/SetAzureRMContext.cs | 2 +- ...rosoft.Azure.Commands.Profile.dll-Help.xml | 38 +++++++++---------- .../Profile/SaveAzureRMProfile.cs | 2 +- .../Profile/SelectAzureRMProfile.cs | 2 +- 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs index 947528113132..254ef0f98653 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs @@ -34,7 +34,7 @@ namespace Microsoft.Azure.Commands.KeyVault /// 4 .Create a HSM or software key by importing key material with given key /// attributes /// - [Cmdlet(VerbsCommon.Add, "AzureRmKeyVaultKey", + [Cmdlet(VerbsCommon.Add, "AzureKeyVaultKey", DefaultParameterSetName = CreateParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(KeyBundle))] diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs index 93fcf472b4cc..29f82674b41d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.KeyVault /// /// Requests that a backup of the specified key be downloaded and stored to a file /// - [Cmdlet(VerbsData.Backup, "AzureRmKeyVaultKey", HelpUri = Constants.KeyVaultHelpUri)] + [Cmdlet(VerbsData.Backup, "AzureKeyVaultKey", HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(String))] public class BackupAzureKeyVaultKey : KeyVaultCmdletBase { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs index 79a1966e4bac..2623d9579d52 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.KeyVault { - [Cmdlet(VerbsCommon.Get, "AzureRmKeyVaultKey", + [Cmdlet(VerbsCommon.Get, "AzureKeyVaultKey", DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(List), typeof(KeyBundle))] diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs index 4a486c192cf3..3a3911e875f1 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.KeyVault { - [Cmdlet(VerbsCommon.Get, "AzureRmKeyVaultSecret", + [Cmdlet(VerbsCommon.Get, "AzureKeyVaultSecret", DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(List), typeof(Secret))] diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs index ea8c2c8cc4dd..fd55f20be13b 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.KeyVault { - [Cmdlet(VerbsCommon.Remove, "AzureRmKeyVaultKey", + [Cmdlet(VerbsCommon.Remove, "AzureKeyVaultKey", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs index d28d73f0d7f6..746f637e5f8a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.KeyVault { - [Cmdlet(VerbsCommon.Remove, "AzureRmKeyVaultSecret", + [Cmdlet(VerbsCommon.Remove, "AzureKeyVaultSecret", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs index c76614d9c3e2..46f33f0cf538 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.KeyVault /// /// Restores the backup key into a vault /// - [Cmdlet(VerbsData.Restore, "AzureRmKeyVaultKey", HelpUri = Constants.KeyVaultHelpUri)] + [Cmdlet(VerbsData.Restore, "AzureKeyVaultKey", HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(KeyBundle))] public class RestoreAzureKeyVaultKey : KeyVaultCmdletBase { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs index 79d154332aa5..f4fb3f25f1db 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.KeyVault /// Update attribute of a key vault key. /// [Alias("Set-AzureKeyVaultKey")] - [Cmdlet(VerbsCommon.Set, "AzureRmKeyVaultKeyAttribute", HelpUri = Constants.KeyVaultHelpUri)] + [Cmdlet(VerbsCommon.Set, "AzureKeyVaultKeyAttribute", HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(KeyBundle))] public class SetAzureKeyVaultKeyAttribute : KeyVaultCmdletBase { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs index 55c175558b42..fe9d92a37a24 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.KeyVault { - [Cmdlet(VerbsCommon.Set, "AzureRmKeyVaultSecret", HelpUri = Constants.KeyVaultHelpUri)] + [Cmdlet(VerbsCommon.Set, "AzureKeyVaultSecret", HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(Secret))] public class SetAzureKeyVaultSecret : KeyVaultCmdletBase { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs index c67b068df682..a7c77837308a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.KeyVault { - [Cmdlet(VerbsCommon.Set, "AzureRmKeyVaultSecretAttribute", HelpUri = Constants.KeyVaultHelpUri)] + [Cmdlet(VerbsCommon.Set, "AzureKeyVaultSecretAttribute", HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(Secret))] public class SetAzureKeyVaultSecretAttribute : KeyVaultCmdletBase { diff --git a/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs b/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs index dc3e1a7eee56..b5476c8a08eb 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.Profile /// /// Cmdlet to change current Azure context. /// - [Cmdlet(VerbsCommon.Set, "AzureRMContext", DefaultParameterSetName =TenantIdAndSubscriptionIdParameterSet)] + [Cmdlet(VerbsCommon.Set, "AzureRmContext", DefaultParameterSetName =TenantIdAndSubscriptionIdParameterSet)] [Alias("Select-AzureRmSubscription")] [OutputType(typeof(PSAzureContext))] public class SetAzureRMContextCommand : AzureRMCmdlet diff --git a/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.dll-Help.xml b/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.dll-Help.xml index 04ff1058f9c1..cae9dfa3e623 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.dll-Help.xml +++ b/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.dll-Help.xml @@ -1760,7 +1760,7 @@ Subscription Name: Contoso Subscription 1 - Save-AzureRMProfile + Save-AzureRmProfile Save the current authentication information for use in other PowerShell sessions. @@ -1768,7 +1768,7 @@ Subscription Name: Contoso Subscription 1 Save - AzureRMProfile + AzureRmProfile @@ -1776,13 +1776,13 @@ Subscription Name: Contoso Subscription 1 - Save-AzureRMProfile + Save-AzureRmProfile Profile If provided, saves the given profile to the provided path. If no profile is provided, the currently active profile will be saved. - AzureRMProfile + AzureRmProfile Path @@ -1813,9 +1813,9 @@ Subscription Name: Contoso Subscription 1 If provided, saves the given profile to the provided path. If no profile is provided, the currently active profile will be saved. - AzureRMProfile + AzureRmProfile - AzureRMProfile + AzureRmProfile @@ -1919,7 +1919,7 @@ Subscription Name: Contoso Subscription 1 - Select-AzureRMProfile + Select-AzureRmProfile Load authentication information from the given file. This sets the current context and azure environment metadata used by all cmdlets in the current session. @@ -1927,7 +1927,7 @@ Subscription Name: Contoso Subscription 1 Select - AzureRMProfile + AzureRmProfile @@ -1935,13 +1935,13 @@ Subscription Name: Contoso Subscription 1 - Select-AzureRMProfile + Select-AzureRmProfile Profile The profile to select as the current profile in the given session. - AzureRMProfile + AzureRmProfile InformationAction @@ -1959,7 +1959,7 @@ Subscription Name: Contoso Subscription 1 - Select-AzureRMProfile + Select-AzureRmProfile Path @@ -1989,9 +1989,9 @@ Subscription Name: Contoso Subscription 1 The profile to select as the current profile in the given session. - AzureRMProfile + AzureRmProfile - AzureRMProfile + AzureRmProfile @@ -2085,7 +2085,7 @@ Subscription Name: Contoso Subscription 1 - Set-AzureRMContext + Set-AzureRmContext Set the tenant, subscription, and environment to be used by cmdlets in this session. @@ -2093,7 +2093,7 @@ Subscription Name: Contoso Subscription 1 Set - AzureRMContext + AzureRmContext @@ -2101,7 +2101,7 @@ Subscription Name: Contoso Subscription 1 - Set-AzureRMContext + Set-AzureRmContext TenantId @@ -2132,7 +2132,7 @@ Subscription Name: Contoso Subscription 1 - Set-AzureRMContext + Set-AzureRmContext TenantId @@ -2156,7 +2156,7 @@ Subscription Name: Contoso Subscription 1 - Set-AzureRMContext + Set-AzureRmContext SubscriptionId @@ -2180,7 +2180,7 @@ Subscription Name: Contoso Subscription 1 - Set-AzureRMContext + Set-AzureRmContext Tenant diff --git a/src/ResourceManager/Profile/Commands.Profile/Profile/SaveAzureRMProfile.cs b/src/ResourceManager/Profile/Commands.Profile/Profile/SaveAzureRMProfile.cs index ef1aec4e42ef..ecaddc706af0 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Profile/SaveAzureRMProfile.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Profile/SaveAzureRMProfile.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.Profile /// /// Saves Microsoft Azure profile. /// - [Cmdlet(VerbsData.Save, "AzureRMProfile"), OutputType(typeof(PSAzureProfile))] + [Cmdlet(VerbsData.Save, "AzureRmProfile"), OutputType(typeof(PSAzureProfile))] public class SaveAzureRMProfileCommand : AzureRMCmdlet { [Parameter(Mandatory = false, Position = 0, ValueFromPipelineByPropertyName = true)] diff --git a/src/ResourceManager/Profile/Commands.Profile/Profile/SelectAzureRMProfile.cs b/src/ResourceManager/Profile/Commands.Profile/Profile/SelectAzureRMProfile.cs index 58060fa9f06c..410aa662d539 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Profile/SelectAzureRMProfile.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Profile/SelectAzureRMProfile.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.Profile /// /// Selects Microsoft Azure profile. /// - [Cmdlet(VerbsCommon.Select, "AzureRMProfile"), OutputType(typeof(PSAzureProfile))] + [Cmdlet(VerbsCommon.Select, "AzureRmProfile"), OutputType(typeof(PSAzureProfile))] public class SelectAzureRMProfileCommand : AzureRMCmdlet { internal const string InMemoryProfileParameterSet = "InMemoryProfile"; From d7ae6f31140cfcba9699cb63ba6c86cc4fb6ab4b Mon Sep 17 00:00:00 2001 From: markcowl Date: Wed, 7 Oct 2015 21:43:26 -0700 Subject: [PATCH 04/17] Fix remaining issues with storage account and DSC/IAAS extensions --- .../AzureSubscriptionExtensions.cs | 60 +++++++++++++++++++ .../DSC/DscExtensionCmdletCommonBase.cs | 17 +----- .../Models/PsAzureSubscription.cs | 27 --------- .../CloudService/CloudServiceClient.cs | 2 +- .../Websites/EnableAzureWebsiteDiagnostic.cs | 11 +++- 5 files changed, 73 insertions(+), 44 deletions(-) create mode 100644 src/Common/Commands.Common/AzureSubscriptionExtensions.cs diff --git a/src/Common/Commands.Common/AzureSubscriptionExtensions.cs b/src/Common/Commands.Common/AzureSubscriptionExtensions.cs new file mode 100644 index 000000000000..7be35662bc98 --- /dev/null +++ b/src/Common/Commands.Common/AzureSubscriptionExtensions.cs @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Azure.Common.Authentication.Models; + +namespace Microsoft.WindowsAzure.Commands.Common +{ + public static class AzureSubscriptionExtensions + { + + public static string GetStorageAccountName(this AzureSubscription subscription) + { + if (subscription == null || !subscription.IsPropertySet(AzureSubscription.Property.StorageAccount)) + { + return null; + } + + var result = subscription.GetProperty(AzureSubscription.Property.StorageAccount); + if (!string.IsNullOrWhiteSpace(result)) + { + try + { + var pairs = result.Split(new char[]{';'}, StringSplitOptions.RemoveEmptyEntries); + foreach (var pair in pairs) + { + var sides = pair.Split(new char[] {'='}, 2, StringSplitOptions.RemoveEmptyEntries); + if (string.Equals("AccountName", sides[0].Trim(), StringComparison.OrdinalIgnoreCase)) + { + result = sides[1].Trim(); + break; + } + } + } + catch + { + // if there are any errors, return the unchanged account name + } + } + + return result; + } + + } +} diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/DscExtensionCmdletCommonBase.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/DscExtensionCmdletCommonBase.cs index 74f205f77d39..90c2a1271933 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/DscExtensionCmdletCommonBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/DscExtensionCmdletCommonBase.cs @@ -44,21 +44,10 @@ internal static StorageCredentials GetStorageCredentials(this AzureSMCmdlet cmdl } else { - var storageAccountName = cmdlet.Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); - - var storageClient = AzureSession.ClientFactory.CreateClient( - cmdlet.Profile, cmdlet.Profile.Context.Subscription, AzureEnvironment.Endpoint.ServiceManagement); - - if (!string.IsNullOrEmpty(storageAccountName) && storageClient != null) + var storageAccount = cmdlet.Profile.Context.GetCurrentStorageAccount(); + if (storageAccount != null) { - var keys = storageClient.StorageAccounts.GetKeys(storageAccountName); - - if (keys != null) - { - var storageAccountKey = string.IsNullOrEmpty(keys.PrimaryKey) ? keys.SecondaryKey : keys.PrimaryKey; - - credentials = new StorageCredentials(storageAccountName, storageAccountKey); - } + credentials = storageAccount.Credentials; } } diff --git a/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscription.cs b/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscription.cs index d3eb9a0d2f88..1478f48af722 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscription.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/Models/PsAzureSubscription.cs @@ -57,32 +57,5 @@ public PSAzureSubscription(AzureSubscription subscription, AzureSMProfile profil public string CurrentStorageAccountName { get; set; } public string TenantId { get; set; } - - public string GetAccountName() - { - var result = CurrentStorageAccountName; - if (!string.IsNullOrWhiteSpace(result)) - { - try - { - var pairs = result.Split(new char[]{';'}, StringSplitOptions.RemoveEmptyEntries); - foreach (var pair in pairs) - { - var sides = pair.Split(new char[] {'='}, 2, StringSplitOptions.RemoveEmptyEntries); - if (string.Equals("AccountName", sides[0].Trim(), StringComparison.OrdinalIgnoreCase)) - { - result = sides[1].Trim(); - break; - } - } - } - catch - { - // if there are any errors, return the unchanged account name - } - } - - return result; - } } } diff --git a/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs b/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs index e9b7fad50cc3..1f734ed34575 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/CloudService/CloudServiceClient.cs @@ -502,7 +502,7 @@ private PublishContext CreatePublishContext( // If there's no storage service provided, try using the default one if (string.IsNullOrEmpty(storageServiceName)) { - storageServiceName = Subscription.GetProperty(AzureSubscription.Property.StorageAccount); + storageServiceName = Subscription.GetStorageAccountName(); } ServiceSettings serviceSettings = ServiceSettings.LoadDefault( diff --git a/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs b/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs index 79d491c40c1a..e09993e1d257 100644 --- a/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs +++ b/src/ServiceManagement/Services/Commands/Websites/EnableAzureWebsiteDiagnostic.cs @@ -15,6 +15,7 @@ using System.Collections.Generic; using System.Management.Automation; using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Common; using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.DeploymentEntities; @@ -68,8 +69,14 @@ public override void ExecuteCmdlet() } else if (TableStorage.IsPresent || BlobStorage.IsPresent) { - properties[DiagnosticProperties.StorageAccountName] = string.IsNullOrEmpty(StorageAccountName) ? - Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount) : StorageAccountName; + if (string.IsNullOrWhiteSpace(StorageAccountName)) + { + properties[DiagnosticProperties.StorageAccountName] = Profile.Context.Subscription.GetStorageAccountName(); + } + else + { + properties[DiagnosticProperties.StorageAccountName] = StorageAccountName; + } if (TableStorage.IsPresent) { From 0ce925d4e59edb40c2dd24d6bb3b9d660ab4e669 Mon Sep 17 00:00:00 2001 From: markcowl Date: Wed, 7 Oct 2015 21:52:46 -0700 Subject: [PATCH 05/17] Additional usages of raw subscription --- src/Common/Commands.Common/Commands.Common.csproj | 1 + .../HostedServices/NewAzureDeployment.cs | 3 ++- .../HostedServices/SetAzureDeployment.cs | 3 ++- .../Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj index 9546b1199367..6a2a6519ba57 100644 --- a/src/Common/Commands.Common/Commands.Common.csproj +++ b/src/Common/Commands.Common/Commands.Common.csproj @@ -148,6 +148,7 @@ + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs index 3bf023b5faf3..6046108d14ec 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs @@ -17,6 +17,7 @@ using System.Management.Automation; using System.Net; using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties; @@ -113,7 +114,7 @@ public virtual void NewPaaSDeploymentProcess() AssertNoPersistenVmRoleExistsInDeployment(PVM.DeploymentSlotType.Production); AssertNoPersistenVmRoleExistsInDeployment(PVM.DeploymentSlotType.Staging); - var storageName = Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); + var storageName = Profile.Context.Subscription.GetStorageAccountName(); Uri packageUrl; if (this.Package.StartsWith(Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) || diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs index 114aa15cba3c..33b93a0d6de5 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs @@ -23,6 +23,7 @@ using Microsoft.WindowsAzure.Management.Compute.Models; using Microsoft.WindowsAzure.Management.Compute; using Hyak.Common; +using Microsoft.WindowsAzure.Commands.Common; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices { @@ -198,7 +199,7 @@ public void ExecuteCommand() if (string.Compare(ParameterSetName, "Upgrade", StringComparison.OrdinalIgnoreCase) == 0) { bool removePackage = false; - var storageName = Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); + var storageName = Profile.Context.Subscription.GetStorageAccountName(); Uri packageUrl = null; if (Package.StartsWith(Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) || diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs index ed7caee7b15c..9333d2f6d08f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/CustomScript/SetAzureVMCustomScriptExtension.cs @@ -210,7 +210,7 @@ protected override void ValidateParameters() protected string GetStorageName() { - return Profile.Context.Subscription.GetProperty(AzureSubscription.Property.StorageAccount); + return Profile.Context.Subscription.GetStorageAccountName(); } protected string GetStorageKey(string storageName) From 834fec3cf6fbec0fb2b141a20252dc739c205ae4 Mon Sep 17 00:00:00 2001 From: stankovski Date: Thu, 8 Oct 2015 10:37:03 -0700 Subject: [PATCH 06/17] Increased minor version of all packages to 0.10.0 --- src/Common/Storage/Azure.Storage.psd1 | 4 ++-- .../ApiManagement/AzureRM.ApiManagement.psd1 | 4 ++-- .../Automation/AzureRM.Automation.psd1 | 4 ++-- .../AzureBackup/AzureRM.Backup.psd1 | 4 ++-- .../AzureBatch/AzureRM.Batch.psd1 | 4 ++-- .../Compute/AzureRM.Compute.psd1 | 4 ++-- .../DataFactories/AzureRM.DataFactories.psd1 | 4 ++-- src/ResourceManager/Dns/AzureRM.Dns.psd1 | 4 ++-- .../HDInsight/AzureRM.HDInsight.psd1 | 4 ++-- .../Insights/AzureRM.Insights.psd1 | 4 ++-- .../KeyVault/AzureRM.KeyVault.psd1 | 4 ++-- .../Network/AzureRM.Network.psd1 | 4 ++-- .../AzureRM.OperationalInsights.psd1 | 4 ++-- .../Profile/AzureRM.Profile.psd1 | 2 +- .../RedisCache/AzureRM.RedisCache.psd1 | 4 ++-- .../Resources/AzureRM.Resources.psd1 | 4 ++-- .../AzureResourceManager.psd1 | 2 +- .../SiteRecovery/AzureRM.SiteRecovery.psd1 | 4 ++-- src/ResourceManager/Sql/AzureRM.Sql.psd1 | 4 ++-- .../Storage/AzureRM.Storage.psd1 | 6 +++--- .../AzureRM.StreamAnalytics.psd1 | 4 ++-- src/ResourceManager/Tags/AzureRM.Tags.psd1 | 4 ++-- .../AzureRM.TrafficManager.psd1 | 4 ++-- .../AzureRM.UsageAggregates.psd1 | 4 ++-- .../Websites/AzureRM.Websites.psd1 | 4 ++-- tools/AzureRM/AzureRM.psd1 | Bin 5292 -> 5292 bytes 26 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/Common/Storage/Azure.Storage.psd1 b/src/Common/Storage/Azure.Storage.psd1 index 70e49fec200a..451d1c5270cb 100644 --- a/src/Common/Storage/Azure.Storage.psd1 +++ b/src/Common/Storage/Azure.Storage.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '00612bca-fa22-401d-a671-9cc48b010e3b' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/ApiManagement/AzureRM.ApiManagement.psd1 b/src/ResourceManager/ApiManagement/AzureRM.ApiManagement.psd1 index dc100a7d7ed5..dcd616697532 100644 --- a/src/ResourceManager/ApiManagement/AzureRM.ApiManagement.psd1 +++ b/src/ResourceManager/ApiManagement/AzureRM.ApiManagement.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'f875725d-8ce4-423f-a6af-ea880bc63f13' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Automation/AzureRM.Automation.psd1 b/src/ResourceManager/Automation/AzureRM.Automation.psd1 index 7e7f658a4ca9..f87afac7fc7d 100644 --- a/src/ResourceManager/Automation/AzureRM.Automation.psd1 +++ b/src/ResourceManager/Automation/AzureRM.Automation.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'bcea1c70-a32b-48c3-a05c-323e1c02f4d3' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/AzureBackup/AzureRM.Backup.psd1 b/src/ResourceManager/AzureBackup/AzureRM.Backup.psd1 index 8f9ce8488534..8ea35c2e9e90 100644 --- a/src/ResourceManager/AzureBackup/AzureRM.Backup.psd1 +++ b/src/ResourceManager/AzureBackup/AzureRM.Backup.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '0b1d76f5-a928-4b8f-9c83-df26947568d4' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/AzureBatch/AzureRM.Batch.psd1 b/src/ResourceManager/AzureBatch/AzureRM.Batch.psd1 index 18db766319dd..54f98509714e 100644 --- a/src/ResourceManager/AzureBatch/AzureRM.Batch.psd1 +++ b/src/ResourceManager/AzureBatch/AzureRM.Batch.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'a8f00f40-1c1a-49b5-9db3-24076b75c3cf' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Compute/AzureRM.Compute.psd1 b/src/ResourceManager/Compute/AzureRM.Compute.psd1 index f0b2248dd478..f60bc668875a 100644 --- a/src/ResourceManager/Compute/AzureRM.Compute.psd1 +++ b/src/ResourceManager/Compute/AzureRM.Compute.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '0a83c907-1ffb-4d87-a492-c65ac7d7ed37' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/DataFactories/AzureRM.DataFactories.psd1 b/src/ResourceManager/DataFactories/AzureRM.DataFactories.psd1 index df860e6e8271..ce0e38c229a5 100644 --- a/src/ResourceManager/DataFactories/AzureRM.DataFactories.psd1 +++ b/src/ResourceManager/DataFactories/AzureRM.DataFactories.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'e3c0f6bc-fe96-41a0-88f4-5e490a91f05d' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Dns/AzureRM.Dns.psd1 b/src/ResourceManager/Dns/AzureRM.Dns.psd1 index a40559d1082b..81fcb22d0e3c 100644 --- a/src/ResourceManager/Dns/AzureRM.Dns.psd1 +++ b/src/ResourceManager/Dns/AzureRM.Dns.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '5e5ed8bc-27bf-4380-9de1-4b22ba0920b2' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/HDInsight/AzureRM.HDInsight.psd1 b/src/ResourceManager/HDInsight/AzureRM.HDInsight.psd1 index ee47bdce76c0..26aacd454aa6 100644 --- a/src/ResourceManager/HDInsight/AzureRM.HDInsight.psd1 +++ b/src/ResourceManager/HDInsight/AzureRM.HDInsight.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '3fd1475f-cb23-4ffb-bf08-33d94b7d1acb' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Insights/AzureRM.Insights.psd1 b/src/ResourceManager/Insights/AzureRM.Insights.psd1 index 2884dec6e8c4..1bcbb779471a 100644 --- a/src/ResourceManager/Insights/AzureRM.Insights.psd1 +++ b/src/ResourceManager/Insights/AzureRM.Insights.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '698c387c-bd6b-41c6-82ce-721f1ef39548' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/KeyVault/AzureRM.KeyVault.psd1 b/src/ResourceManager/KeyVault/AzureRM.KeyVault.psd1 index 3641951f0667..5e2c6ce9d41c 100644 --- a/src/ResourceManager/KeyVault/AzureRM.KeyVault.psd1 +++ b/src/ResourceManager/KeyVault/AzureRM.KeyVault.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'fa236c1f-6464-4d6a-a48d-db47c0e7923d' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Network/AzureRM.Network.psd1 b/src/ResourceManager/Network/AzureRM.Network.psd1 index 8ee727943271..2a7d5e164abb 100644 --- a/src/ResourceManager/Network/AzureRM.Network.psd1 +++ b/src/ResourceManager/Network/AzureRM.Network.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'eb75c732-e274-4a20-b502-e9958e63484a' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/OperationalInsights/AzureRM.OperationalInsights.psd1 b/src/ResourceManager/OperationalInsights/AzureRM.OperationalInsights.psd1 index 418704f1b874..2761f848f396 100644 --- a/src/ResourceManager/OperationalInsights/AzureRM.OperationalInsights.psd1 +++ b/src/ResourceManager/OperationalInsights/AzureRM.OperationalInsights.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'e827799a-7abf-4538-a61f-94dc52a48bd4' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Profile/AzureRM.Profile.psd1 b/src/ResourceManager/Profile/AzureRM.Profile.psd1 index 737e51ce6071..99542f8697bb 100644 --- a/src/ResourceManager/Profile/AzureRM.Profile.psd1 +++ b/src/ResourceManager/Profile/AzureRM.Profile.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.11' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '342714fc-4009-4863-8afb-a9067e3db04b' diff --git a/src/ResourceManager/RedisCache/AzureRM.RedisCache.psd1 b/src/ResourceManager/RedisCache/AzureRM.RedisCache.psd1 index 7ecfb4e8e8e7..df143b1d30af 100644 --- a/src/ResourceManager/RedisCache/AzureRM.RedisCache.psd1 +++ b/src/ResourceManager/RedisCache/AzureRM.RedisCache.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '820628d7-6938-488a-8760-43373a5ffce6' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Resources/AzureRM.Resources.psd1 b/src/ResourceManager/Resources/AzureRM.Resources.psd1 index 46753548826c..78ccb5376ef4 100644 --- a/src/ResourceManager/Resources/AzureRM.Resources.psd1 +++ b/src/ResourceManager/Resources/AzureRM.Resources.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'ab3ca893-26fe-44b0-bd3c-8933df144d7b' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 index 518bef77e7fa..6304f2a8b5b9 100644 --- a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 +++ b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '81d522a4-6e5d-4105-8f58-376204c47458' diff --git a/src/ResourceManager/SiteRecovery/AzureRM.SiteRecovery.psd1 b/src/ResourceManager/SiteRecovery/AzureRM.SiteRecovery.psd1 index 2cbda9d1cff4..176a7d3384bb 100644 --- a/src/ResourceManager/SiteRecovery/AzureRM.SiteRecovery.psd1 +++ b/src/ResourceManager/SiteRecovery/AzureRM.SiteRecovery.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'd1de7560-48e1-48f3-bc8c-4eea3af2bbe1' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Sql/AzureRM.Sql.psd1 b/src/ResourceManager/Sql/AzureRM.Sql.psd1 index fb207dc703a9..419892445d72 100644 --- a/src/ResourceManager/Sql/AzureRM.Sql.psd1 +++ b/src/ResourceManager/Sql/AzureRM.Sql.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '150d9544-6348-4373-806f-10cd0b4de4cb' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Storage/AzureRM.Storage.psd1 b/src/ResourceManager/Storage/AzureRM.Storage.psd1 index 2be2bac364fd..45e4a59c2048 100644 --- a/src/ResourceManager/Storage/AzureRM.Storage.psd1 +++ b/src/ResourceManager/Storage/AzureRM.Storage.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'da67eaa7-4cb1-4bfa-a194-8bf3faae8ac5' @@ -46,8 +46,8 @@ ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module RequiredModules = @( - @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }, - @{ ModuleName = 'Azure.Storage'; ModuleVersion = '0.9.10' } + @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}, + @{ ModuleName = 'Azure.Storage'; ModuleVersion = '0.10.0'} ) # Assemblies that must be loaded prior to importing this module diff --git a/src/ResourceManager/StreamAnalytics/AzureRM.StreamAnalytics.psd1 b/src/ResourceManager/StreamAnalytics/AzureRM.StreamAnalytics.psd1 index bc3ad7380887..7636982edf5b 100644 --- a/src/ResourceManager/StreamAnalytics/AzureRM.StreamAnalytics.psd1 +++ b/src/ResourceManager/StreamAnalytics/AzureRM.StreamAnalytics.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '59713673-194f-418a-b1f2-ac60db82edf9' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Tags/AzureRM.Tags.psd1 b/src/ResourceManager/Tags/AzureRM.Tags.psd1 index c2cb2f7159ce..2b2a41badedc 100644 --- a/src/ResourceManager/Tags/AzureRM.Tags.psd1 +++ b/src/ResourceManager/Tags/AzureRM.Tags.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '59713673-194f-418a-b1f2-ac60db82edf9' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/TrafficManager/AzureRM.TrafficManager.psd1 b/src/ResourceManager/TrafficManager/AzureRM.TrafficManager.psd1 index 6425d38a78ba..8fc0b31f5aeb 100644 --- a/src/ResourceManager/TrafficManager/AzureRM.TrafficManager.psd1 +++ b/src/ResourceManager/TrafficManager/AzureRM.TrafficManager.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = '59713673-194f-418a-b1f2-ac60db82edf9' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/UsageAggregates/AzureRM.UsageAggregates.psd1 b/src/ResourceManager/UsageAggregates/AzureRM.UsageAggregates.psd1 index 5eba83c03581..6d5a2d869a88 100644 --- a/src/ResourceManager/UsageAggregates/AzureRM.UsageAggregates.psd1 +++ b/src/ResourceManager/UsageAggregates/AzureRM.UsageAggregates.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'e43e47c8-8bff-4013-b003-ded1741f403a' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/src/ResourceManager/Websites/AzureRM.Websites.psd1 b/src/ResourceManager/Websites/AzureRM.Websites.psd1 index f9c04da5d9a4..c3a12e7106cd 100644 --- a/src/ResourceManager/Websites/AzureRM.Websites.psd1 +++ b/src/ResourceManager/Websites/AzureRM.Websites.psd1 @@ -9,7 +9,7 @@ @{ # Version number of this module. -ModuleVersion = '0.9.10' +ModuleVersion = '0.10.0' # ID used to uniquely identify this module GUID = 'cc69c625-e961-43f4-8b50-0061eba6e4b6' @@ -45,7 +45,7 @@ CLRVersion='4.0' ProcessorArchitecture = 'None' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.9.10' }) +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '0.10.0'}) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/tools/AzureRM/AzureRM.psd1 b/tools/AzureRM/AzureRM.psd1 index 8e8428b65704317fdb1616b123766cb772943f88..a736222632bd7fb03c11fb227a48f238c7941c0c 100644 GIT binary patch delta 24 fcmZ3ZxkhtC856r9g8_pcgTZ7&Hu23 Date: Thu, 8 Oct 2015 11:42:14 -0700 Subject: [PATCH 07/17] Support SM/RM cmdlets execution with RP registration --- .../Commands.ResourceManager.Common/AzureRMCmdlet.cs | 7 ++++++- .../RPRegistrationDelegatingHandler.cs | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs index 534e719037ac..2d3ad79efe06 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs @@ -43,11 +43,16 @@ static AzureRMCmdlet() } } + /// + /// Creates new instance from AzureRMCmdlet and add the RPRegistration handler. + /// public AzureRMCmdlet() { AzureSession.ClientFactory.RemoveHandler(typeof(RPRegistrationDelegatingHandler)); AzureSession.ClientFactory.AddHandler(new RPRegistrationDelegatingHandler( - () => AzureSession.ClientFactory.CreateClient(DefaultContext, AzureEnvironment.Endpoint.ResourceManager), + () => new ResourceManagementClient( + AzureSession.AuthenticationFactory.GetSubscriptionCloudCredentials(DefaultContext, AzureEnvironment.Endpoint.ResourceManager), + DefaultContext.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager)), s => _debugMessages.Enqueue(s))); } diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/RPRegistrationDelegatingHandler.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/RPRegistrationDelegatingHandler.cs index 4bc45f617e86..62e6f4e8cdca 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/RPRegistrationDelegatingHandler.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/RPRegistrationDelegatingHandler.cs @@ -48,8 +48,6 @@ public RPRegistrationDelegatingHandler(Func createClie protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { - ResourceManagementClient = createClient(); - HttpResponseMessage responseMessage = await base.SendAsync(request, cancellationToken).ConfigureAwait(false); if (IsProviderNotRegistereError(responseMessage)) { @@ -61,6 +59,7 @@ protected override async Task SendAsync(HttpRequestMessage registeredProviders.Add(providerName); try { + ResourceManagementClient = createClient(); writeDebug(string.Format(Resources.ResourceProviderRegisterAttempt, providerName)); ResourceManagementClient.Providers.Register(providerName); Provider provider = null; From d4b8469b9f7568cffadf00d013ef59672da06413 Mon Sep 17 00:00:00 2001 From: stankovski Date: Thu, 8 Oct 2015 12:36:14 -0700 Subject: [PATCH 08/17] Bumped up MSI and AzureRM version to 1.0 --- setup-powershellget/azurecmd.wxs | 2 +- tools/AzureRM/AzureRM.psd1 | Bin 5292 -> 5286 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-powershellget/azurecmd.wxs b/setup-powershellget/azurecmd.wxs index 25d5e5df82bc..bb0eea44a684 100644 --- a/setup-powershellget/azurecmd.wxs +++ b/setup-powershellget/azurecmd.wxs @@ -5,7 +5,7 @@ - + diff --git a/tools/AzureRM/AzureRM.psd1 b/tools/AzureRM/AzureRM.psd1 index a736222632bd7fb03c11fb227a48f238c7941c0c..f80973beebc3807e72cca63eb340b482ba792905 100644 GIT binary patch delta 35 ocmZ3ZxlD6I5fi5&gC2tc2v0U-6W=_ADT-;b8;jOv8P*B>0HYWPzW@LL delta 38 scmZ3cxkhtC5firogC2t+1Bf)3?8q#>c@k3;6XVK>vvoI%u} Date: Thu, 8 Oct 2015 12:56:13 -0700 Subject: [PATCH 09/17] Removed verbose setting --- setup-powershellget/Setup/ShortcutStartup.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup-powershellget/Setup/ShortcutStartup.ps1 b/setup-powershellget/Setup/ShortcutStartup.ps1 index a6cd002498ef..d5d622081e41 100644 --- a/setup-powershellget/Setup/ShortcutStartup.ps1 +++ b/setup-powershellget/Setup/ShortcutStartup.ps1 @@ -97,8 +97,6 @@ To use Azure Service Management cmdlets please execute the following cmdlet: Install-Module Azure "@ Write-Output $welcomeMessage - - $VerbosePreference = "Continue" } } catch From 3cd6723b761e958fe162fbc2d3dc4fa1a704b8be Mon Sep 17 00:00:00 2001 From: stankovski Date: Thu, 8 Oct 2015 13:52:17 -0700 Subject: [PATCH 10/17] Added tag "Azure" to packages --- tools/PublishModules.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/PublishModules.ps1 b/tools/PublishModules.ps1 index c50e96e50cc0..08591e98e748 100644 --- a/tools/PublishModules.ps1 +++ b/tools/PublishModules.ps1 @@ -58,7 +58,7 @@ $publishToLocal = test-path $repositoryLocation if (($scope -eq 'All') -or $publishToLocal ) { # If we publish 'All' or to local folder, publish AzureRM.Profile first, becasue it is the common dependency Write-Host "Publishing profile module" - Publish-Module -Path "$resourceManagerRootFolder\AzureRM.Profile" -NuGetApiKey $apiKey -Repository $repoName + Publish-Module -Path "$resourceManagerRootFolder\AzureRM.Profile" -NuGetApiKey $apiKey -Repository $repoName -Tags ("Azure") Write-Host "Published profile module" } @@ -66,21 +66,21 @@ if (($scope -eq 'All') -or ($scope -eq 'ServiceManagement')) { $modulePath = "$packageFolder\$buildConfig\ServiceManagement\Azure" # Publish Azure module Write-Host "Publishing ServiceManagement(aka Azure) module from $modulePath" - Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName + Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName -Tags ("Azure") } 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 + Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName -Tags ("Azure") } if (($scope -eq 'All') -or ($scope -eq 'AzureRM')) { # Publish AzureRM module $modulePath = "$PSScriptRoot\AzureRM" Write-Host "Publishing AzureRM module from $modulePath" - Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName + Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName -Tags ("Azure") Write-Host "Published Azure module" } @@ -92,7 +92,7 @@ if ($scope -eq 'All') { 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 + Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName -Tags ("Azure") Write-Host "Published $module module" } } @@ -100,7 +100,7 @@ if ($scope -eq 'All') { $modulePath = Join-Path $resourceManagerRootFolder "AzureRM.$scope" if (Test-Path $modulePath) { Write-Host "Publishing $scope module from $modulePath" - Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName + Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName -Tags ("Azure") Write-Host "Published $scope module" } else { Write-Error "Can not find module with name $scope to publish" From c9b0b24d0230cadf8aca15fd921dedc94de1ed74 Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 8 Oct 2015 17:17:36 -0700 Subject: [PATCH 11/17] Add incompatible version check [Fixes #105258902] --- tools/AzureRM/AzureRM.psm1 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tools/AzureRM/AzureRM.psm1 b/tools/AzureRM/AzureRM.psm1 index 1aa94cc1340d..4e37be5fc815 100644 --- a/tools/AzureRM/AzureRM.psm1 +++ b/tools/AzureRM/AzureRM.psm1 @@ -38,6 +38,22 @@ function Test-AdminRights([string]$Scope) } } +function CheckIncompatibleVersion([bool]$Force) +{ + $message = "An incompatible version of Azure Resource Manager PowerShell cmdlets is installed. Please uninstall Microsoft Azure PowerShell using the 'Control Panel' before installing these cmdlets. To install these cmdlets regardless of compatibility issues, execute 'Install-AzureRM -Force'." + if ( Test-Path "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureResourceManager.psd1") + { + if ($Force) + { + Write-Warning $message + } + else + { + throw $message + } + } +} + function Install-ModuleWithVersionCheck([string]$Name,[string]$MajorVersion,[string]$Repository,[string]$Scope) { $_MinVer = "$MajorVersion.0.0.0" @@ -81,6 +97,7 @@ function Install-ModuleWithVersionCheck([string]$Name,[string]$MajorVersion,[str #> function Update-AzureRM { + param( [Parameter(Position=0, Mandatory = $false)] [string] @@ -91,9 +108,12 @@ function Update-AzureRM [Parameter(Position=2, Mandatory = $false)] [ValidateSet("CurrentUser","AllUsers")] [string] - $Scope = "AllUsers") + $Scope = "AllUsers", + [switch] + $Force = $false) Test-AdminRights $Scope + CheckIncompatibleVersion($Force.IsPresent) Write-Output "Installing AzureRM modules." @@ -132,7 +152,6 @@ function Import-AzureRM [Parameter(Position=0, Mandatory = $false)] [string] $MajorVersion = $AzureMajorVersion) - Write-Output "Importing AzureRM modules." $_MinVer = "$MajorVersion.0.0.0" From 115ae8810eb0146685425e258f48832d2be67eaf Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 8 Oct 2015 17:22:04 -0700 Subject: [PATCH 12/17] Fix indentation in new script function --- tools/AzureRM/AzureRM.psm1 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/AzureRM/AzureRM.psm1 b/tools/AzureRM/AzureRM.psm1 index 4e37be5fc815..9f2c73a34b1b 100644 --- a/tools/AzureRM/AzureRM.psm1 +++ b/tools/AzureRM/AzureRM.psm1 @@ -40,18 +40,18 @@ function Test-AdminRights([string]$Scope) function CheckIncompatibleVersion([bool]$Force) { - $message = "An incompatible version of Azure Resource Manager PowerShell cmdlets is installed. Please uninstall Microsoft Azure PowerShell using the 'Control Panel' before installing these cmdlets. To install these cmdlets regardless of compatibility issues, execute 'Install-AzureRM -Force'." - if ( Test-Path "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureResourceManager.psd1") - { - if ($Force) - { - Write-Warning $message - } - else - { - throw $message - } - } + $message = "An incompatible version of Azure Resource Manager PowerShell cmdlets is installed. Please uninstall Microsoft Azure PowerShell using the 'Control Panel' before installing these cmdlets. To install these cmdlets regardless of compatibility issues, execute 'Install-AzureRM -Force'." + if ( Test-Path "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureResourceManager.psd1") + { + if ($Force) + { + Write-Warning $message + } + else + { + throw $message + } + } } function Install-ModuleWithVersionCheck([string]$Name,[string]$MajorVersion,[string]$Repository,[string]$Scope) From a661f2b3c25f001afc0c551e240cd24d2f86efe1 Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 8 Oct 2015 17:47:43 -0700 Subject: [PATCH 13/17] fixing the script for32-bit machines --- tools/AzureRM/AzureRM.psm1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/AzureRM/AzureRM.psm1 b/tools/AzureRM/AzureRM.psm1 index 9f2c73a34b1b..61033d81cf6c 100644 --- a/tools/AzureRM/AzureRM.psm1 +++ b/tools/AzureRM/AzureRM.psm1 @@ -41,7 +41,13 @@ function Test-AdminRights([string]$Scope) function CheckIncompatibleVersion([bool]$Force) { $message = "An incompatible version of Azure Resource Manager PowerShell cmdlets is installed. Please uninstall Microsoft Azure PowerShell using the 'Control Panel' before installing these cmdlets. To install these cmdlets regardless of compatibility issues, execute 'Install-AzureRM -Force'." - if ( Test-Path "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureResourceManager.psd1") + $path = ${env:ProgramFiles(x86)} + if ($path -eq $null) + { + $path = ${env:ProgramFiles} + } + + if ( Test-Path "$path\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureResourceManager.psd1") { if ($Force) { From 59f1a01e8b20dfa8ae864be460cdd4ced6fe09c6 Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 8 Oct 2015 20:08:53 -0700 Subject: [PATCH 14/17] Fix issue with context changes not copying the token cache --- .../Commands.Common/GeneralUtilities.cs | 1 - .../AccessTokenExtensions.cs | 16 ++++++- .../AzureRMProfileExtensions.cs | 42 +++++++++++++++++++ .../Commands.ResourceManager.Common.csproj | 1 + .../Context/SetAzureRMContext.cs | 4 +- .../Models/RMProfileClient.cs | 8 ++-- 6 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs diff --git a/src/Common/Commands.Common/GeneralUtilities.cs b/src/Common/Commands.Common/GeneralUtilities.cs index d76ad5fa229a..ccf454082b35 100644 --- a/src/Common/Commands.Common/GeneralUtilities.cs +++ b/src/Common/Commands.Common/GeneralUtilities.cs @@ -442,6 +442,5 @@ public static void ClearCurrentStorageAccount(bool clearSMContext = false) } } } - } } \ No newline at end of file diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs index b0d2563c5d43..a546769f5940 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs @@ -1,4 +1,18 @@ -using System; +// ---------------------------------------------------------------------------------- +// +// 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.Linq; using Microsoft.Azure.Common.Authentication; diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs new file mode 100644 index 000000000000..4ebc460e8d86 --- /dev/null +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs @@ -0,0 +1,42 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Azure.Common.Authentication.Models; + +namespace Microsoft.Azure.Commands.ResourceManager.Common +{ + public static class AzureRMProfileExtensions + { + /// + /// Set the context for the current profile, preserving token cache information + /// + /// The profile to change the context for + /// The new context + public static void SetContext(this AzureRMProfile profile, AzureContext newContext) + { + var currentContext = profile.Context; + if (currentContext != null && currentContext.TokenCache != null && currentContext.TokenCache.Length > 0) + { + newContext.TokenCache = currentContext.TokenCache; + } + + profile.Context = newContext; + } + } +} diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj b/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj index 71534f031656..57f80edf2d29 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj @@ -138,6 +138,7 @@ + diff --git a/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs b/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs index b5476c8a08eb..f0b4ed071500 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs @@ -55,8 +55,8 @@ protected override void ProcessRecord() { if (ParameterSetName == ContextParameterSet) { - AzureRmProfileProvider.Instance.Profile.Context = new AzureContext(Context.Subscription, Context.Account, - Context.Environment, Context.Tenant); + AzureRmProfileProvider.Instance.Profile.SetContext(new AzureContext(Context.Subscription, Context.Account, + Context.Environment, Context.Tenant)); } else { diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs b/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs index 3d553a1abcb0..d0d20267cc69 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs @@ -105,11 +105,11 @@ public AzureContext SetCurrentContext(string subscriptionId, string tenantId) { if (!string.IsNullOrWhiteSpace(tenantId)) { - _profile.Context = new AzureContext( + _profile.SetContext(new AzureContext( _profile.Context.Subscription, _profile.Context.Account, _profile.Context.Environment, - new AzureTenant() { Id = new Guid(tenantId) }); + new AzureTenant() { Id = new Guid(tenantId) })); if (_profile.Context.Account != null) { @@ -139,11 +139,11 @@ public AzureContext SetCurrentContext(string subscriptionId, string tenantId) newSubscription.Name = null; } - _profile.Context = new AzureContext( + _profile.SetContext(new AzureContext( newSubscription, _profile.Context.Account, _profile.Context.Environment, - _profile.Context.Tenant); + _profile.Context.Tenant)); } return _profile.Context; From b3c26e5ecabf80231b679b203f103fe3681dda45 Mon Sep 17 00:00:00 2001 From: markcowl Date: Thu, 8 Oct 2015 23:29:09 -0700 Subject: [PATCH 15/17] Ensure that TokenCache is transmitted to context when context is set --- .../AzureRMProfileExtensions.cs | 17 ++++++++---- .../Properties/Resources.Designer.cs | 26 ++++++++++++++++--- .../Properties/Resources.resx | 6 +++++ .../AzureRMProfileTests.cs | 14 ++++++++++ .../Context/SetAzureRMContext.cs | 2 +- .../Models/RMProfileClient.cs | 4 +-- 6 files changed, 57 insertions(+), 12 deletions(-) diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs index 4ebc460e8d86..e2dc5eed060c 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMProfileExtensions.cs @@ -17,7 +17,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Microsoft.Azure.Commands.ResourceManager.Common.Properties; using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.IdentityModel.Clients.ActiveDirectory; namespace Microsoft.Azure.Commands.ResourceManager.Common { @@ -27,15 +29,20 @@ public static class AzureRMProfileExtensions /// Set the context for the current profile, preserving token cache information /// /// The profile to change the context for - /// The new context - public static void SetContext(this AzureRMProfile profile, AzureContext newContext) + /// The new context, with no token cache information. + public static void SetContextWithCache(this AzureRMProfile profile, AzureContext newContext) { - var currentContext = profile.Context; - if (currentContext != null && currentContext.TokenCache != null && currentContext.TokenCache.Length > 0) + if (profile == null) { - newContext.TokenCache = currentContext.TokenCache; + throw new ArgumentNullException("profile", Resources.ProfileCannotBeNull); } + if (newContext == null) + { + throw new ArgumentNullException("newContext", Resources.ContextCannotBeNull); + } + + newContext.TokenCache = TokenCache.DefaultShared.Serialize(); profile.Context = newContext; } } diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Properties/Resources.Designer.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Properties/Resources.Designer.cs index 3622d8e6e313..e8836fe4a665 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/Properties/Resources.Designer.cs +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.Azure.Commands.ResourceManager.Common.Properties -{ - - +namespace Microsoft.Azure.Commands.ResourceManager.Common.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -60,6 +60,15 @@ internal Resources() { } } + /// + /// Looks up a localized string similar to Context cannot be null. Please log in using Add-AzureRmAccount.. + /// + public static string ContextCannotBeNull { + get { + return ResourceManager.GetString("ContextCannotBeNull", resourceCulture); + } + } + /// /// Looks up a localized string similar to Microsoft Azure PowerShell Data Collection Confirmation. /// @@ -135,6 +144,15 @@ public static string NoSubscriptionFound { } } + /// + /// Looks up a localized string similar to Profile cannot be null. Please run Add-AzureRmAccount.. + /// + public static string ProfileCannotBeNull { + get { + return ResourceManager.GetString("ProfileCannotBeNull", resourceCulture); + } + } + /// /// Looks up a localized string similar to Attempting to register resource provider '{0}'. /// diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Properties/Resources.resx b/src/ResourceManager/Common/Commands.ResourceManager.Common/Properties/Resources.resx index f1be5d7daeec..42973da7336d 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/Properties/Resources.resx +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Properties/Resources.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Context cannot be null. Please log in using Add-AzureRmAccount. + Microsoft Azure PowerShell Data Collection Confirmation @@ -151,6 +154,9 @@ Select Y to enable data collection [Y/N]: The provided account {0} does not have access to any subscriptions. Please try logging in with different credentials. + + Profile cannot be null. Please run Add-AzureRmAccount. + Attempting to register resource provider '{0}' diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/AzureRMProfileTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/AzureRMProfileTests.cs index 8ca2d32b944a..8388f684e677 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/AzureRMProfileTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/AzureRMProfileTests.cs @@ -19,6 +19,7 @@ using System; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; using System.Collections.Generic; +using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.WindowsAzure.Commands.ScenarioTest; namespace Microsoft.Azure.Commands.ResourceManager.Common.Test @@ -131,5 +132,18 @@ public void NoSubscriptionsInListThrows() AzureSubscription subValue; Assert.False(client.TryGetSubscription(DefaultTenant.ToString(), DefaultSubscription.ToString(), out subValue)); } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void SetContextPreservesTokenCache() + { + AzureRMProfile profile = null; + AzureContext context = new AzureContext(null, null, null, null); + Assert.Throws(() =>profile.SetContextWithCache(context)); + profile = new AzureRMProfile(); + Assert.Throws(() => profile.SetContextWithCache(null)); + profile.SetContextWithCache(context); + Assert.Equal(TokenCache.DefaultShared.Serialize(), profile.Context.TokenCache); + } } } diff --git a/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs b/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs index f0b4ed071500..a0a4f38fb9b5 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Context/SetAzureRMContext.cs @@ -55,7 +55,7 @@ protected override void ProcessRecord() { if (ParameterSetName == ContextParameterSet) { - AzureRmProfileProvider.Instance.Profile.SetContext(new AzureContext(Context.Subscription, Context.Account, + AzureRmProfileProvider.Instance.Profile.SetContextWithCache(new AzureContext(Context.Subscription, Context.Account, Context.Environment, Context.Tenant)); } else diff --git a/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs b/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs index d0d20267cc69..dcec21991609 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs +++ b/src/ResourceManager/Profile/Commands.Profile/Models/RMProfileClient.cs @@ -105,7 +105,7 @@ public AzureContext SetCurrentContext(string subscriptionId, string tenantId) { if (!string.IsNullOrWhiteSpace(tenantId)) { - _profile.SetContext(new AzureContext( + _profile.SetContextWithCache(new AzureContext( _profile.Context.Subscription, _profile.Context.Account, _profile.Context.Environment, @@ -139,7 +139,7 @@ public AzureContext SetCurrentContext(string subscriptionId, string tenantId) newSubscription.Name = null; } - _profile.SetContext(new AzureContext( + _profile.SetContextWithCache(new AzureContext( newSubscription, _profile.Context.Account, _profile.Context.Environment, From c72da9795d1ab3bdbddee893b680a47c25ea8e61 Mon Sep 17 00:00:00 2001 From: markcowl Date: Fri, 9 Oct 2015 13:22:26 -0700 Subject: [PATCH 16/17] Update package metadata, license uri, and signing --- build.proj | 1 + src/Common/Storage/Azure.Storage.psd1 | 2 +- .../ApiManagement/AzureRM.ApiManagement.psd1 | 2 +- .../Automation/AzureRM.Automation.psd1 | 2 +- src/ResourceManager/AzureBackup/AzureRM.Backup.psd1 | 2 +- src/ResourceManager/AzureBatch/AzureRM.Batch.psd1 | 2 +- src/ResourceManager/Compute/AzureRM.Compute.psd1 | 2 +- .../DataFactories/AzureRM.DataFactories.psd1 | 2 +- src/ResourceManager/Dns/AzureRM.Dns.psd1 | 2 +- src/ResourceManager/HDInsight/AzureRM.HDInsight.psd1 | 2 +- src/ResourceManager/Insights/AzureRM.Insights.psd1 | 2 +- src/ResourceManager/KeyVault/AzureRM.KeyVault.psd1 | 2 +- src/ResourceManager/Network/AzureRM.Network.psd1 | 2 +- .../AzureRM.OperationalInsights.psd1 | 2 +- src/ResourceManager/Profile/AzureRM.Profile.psd1 | 2 +- .../RedisCache/AzureRM.RedisCache.psd1 | 2 +- src/ResourceManager/Resources/AzureRM.Resources.psd1 | 2 +- .../SiteRecovery/AzureRM.SiteRecovery.psd1 | 2 +- src/ResourceManager/Sql/AzureRM.Sql.psd1 | 2 +- src/ResourceManager/Storage/AzureRM.Storage.psd1 | 2 +- .../StreamAnalytics/AzureRM.StreamAnalytics.psd1 | 2 +- src/ResourceManager/Tags/AzureRM.Tags.psd1 | 2 +- .../TrafficManager/AzureRM.TrafficManager.psd1 | 2 +- .../UsageAggregates/AzureRM.UsageAggregates.psd1 | 2 +- src/ResourceManager/Websites/AzureRM.Websites.psd1 | 2 +- tools/AzureRM/AzureRM.psm1 | 1 + tools/PublishModules.ps1 | 12 ++++++------ 27 files changed, 32 insertions(+), 30 deletions(-) diff --git a/build.proj b/build.proj index 053f39a02271..bfda35c81d8c 100644 --- a/build.proj +++ b/build.proj @@ -214,6 +214,7 @@ + Date: Fri, 9 Oct 2015 14:34:16 -0700 Subject: [PATCH 17/17] Added changes to ARM management cmdlets --- ChangeLog.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 30180d017260..64c48979ad09 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,4 +1,24 @@ -## 2015.09.03 version 0.9.8 +## 2015.10.09 version 1.0 preview +* Azure Resource Manager Management Cmdlets + * New-AzureRmResourceGroup - Removed the template deployment parameters from this cmdlet. Template deployment will now be + handled only through the New-AzureRmResourceGroupDeployment + * Get-AzureRmResource - Will query directly against the Resource Provider. Removed parameters for tags from here. New cmdlets added for querying against the cache as listed below. + * Get-AzureRmResourceGroup - Removed parameters for finding resources through tags. New cmdlet added for handling this + functionality as mentioned below. + * Find-AzureRmResource - Query against the cache. + * Find-AzureRmResourceGroup - Tag parameter added for querying resource group containing specific tags. + * Test-AzureResource - Cmdlet removed. Will be adding a better and reliable way to achieve this scenario which will be guaranteed to work against all Resource providers. + * Test-AzureResourceGroup - Cmdlet removed. Will be adding a better and reliable way to achieve this scenario. + * Get-AzureRmResourceProvider - This cmdlet has been renamed. Earlier it was called Get-AzureProvider. We have changed the output to include locations. Now you can use this to find out which providers and types are available for certain location. + * Cmdlets added for policy + * New-AzureRmPolicyDefinition, Get-AzureRmPolicyDefinition, Set-AzureRMPolicyDefinition, Remove-AzureRmPolicyDefinition + * New-AzureRmPolicyAssignment, Get-AzureRmPolicyAssignment, Set-AzureRmPolicyAssignment, Remove-AzureRmPolicyAssignment + * Consolidated Log cmdlets + * Removed Get-AzureResourceLog, Get-AzureResourceGroupLog, Get-AzureProviderLog + * Added new cmdlet Get-AzureLog which you can use to obtain logs at different scopes like resource group, resource, provider. + * Removed Get-AzureLocation - the functionality is now provided through the Get-AzureRmResourceProvider + +## 2015.09.03 version 0.9.8 * Azure Redis Cache cmdlets * New-AzureRMRedisCache - 'RedisVersion' parameter is deprecated. * Azure Compute (ARM) Cmdlets