From 6704c1bd872cb165ab72f5dd50ae1258b34f6dfc Mon Sep 17 00:00:00 2001 From: cormacpayne Date: Fri, 1 Sep 2017 08:53:08 -0700 Subject: [PATCH 1/6] Initial common runtime cleanup --- ....Common.Authentication.Abstractions.csproj | 2 + .../DiskDataStore.cs | 17 +++++--- .../Properties/Resources.Designer.cs | 30 ++++++++++++- .../Properties/Resources.resx | 9 ++++ .../Utilities/FileUtilities.cs | 42 +++++++++++++++---- .../KeyStoreApplicationCredentialProvider.cs | 1 - .../ServicePrincipalTokenProvider.cs | 1 - .../AzureSessionInitializer.cs | 1 - .../Commands.Common.Authentication.csproj | 4 -- .../Models/MemoryDataStore.cs | 1 - .../Commands.Common/Commands.Common.csproj | 2 - .../Commands.Common/Utilities/Validate.cs | 2 +- 12 files changed, 86 insertions(+), 26 deletions(-) rename src/Common/{Commands.Common => Commands.Common.Authentication.Abstractions}/DiskDataStore.cs (95%) rename src/Common/{Commands.Common => Commands.Common.Authentication.Abstractions}/Utilities/FileUtilities.cs (91%) diff --git a/src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj b/src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj index 3e8c9215bb6e..0aede36e8e1f 100644 --- a/src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj +++ b/src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj @@ -103,6 +103,7 @@ + @@ -155,6 +156,7 @@ + diff --git a/src/Common/Commands.Common/DiskDataStore.cs b/src/Common/Commands.Common.Authentication.Abstractions/DiskDataStore.cs similarity index 95% rename from src/Common/Commands.Common/DiskDataStore.cs rename to src/Common/Commands.Common.Authentication.Abstractions/DiskDataStore.cs index dae9668e62d1..a91736e1289b 100644 --- a/src/Common/Commands.Common/DiskDataStore.cs +++ b/src/Common/Commands.Common.Authentication.Abstractions/DiskDataStore.cs @@ -12,14 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions.Properties; using System; using System.IO; using System.Security.Cryptography.X509Certificates; using System.Text; -using Microsoft.WindowsAzure.Commands.Common.Properties; -namespace Microsoft.WindowsAzure.Commands.Common +namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions { /// /// A ddata store based on the managed windows file system functions (System.IO) @@ -192,7 +191,11 @@ public X509Certificate2 GetCertificate(string thumbprint) } else { - Validate.ValidateStringIsNullOrEmpty(thumbprint, "certificate thumbprint"); + if (string.IsNullOrEmpty(thumbprint)) + { + throw new ArgumentException(string.Format(Resources.InvalidOrEmptyArgumentMessage, "certificate thumbprint")); + } + X509Certificate2Collection certificates; if (TryFindCertificatesInStore(thumbprint, StoreLocation.CurrentUser, out certificates) || TryFindCertificatesInStore(thumbprint, StoreLocation.LocalMachine, out certificates)) @@ -212,7 +215,11 @@ public X509Certificate2 GetCertificate(string thumbprint) /// The certificate to add public void AddCertificate(X509Certificate2 certificate) { - Validate.ValidateNullArgument(certificate, Resources.InvalidCertificate); + if (certificate == null) + { + throw new ArgumentException(Resources.InvalidCertificate); + } + X509StoreWrapper(StoreName.My, StoreLocation.CurrentUser, (store) => { store.Open(OpenFlags.ReadWrite); diff --git a/src/Common/Commands.Common.Authentication.Abstractions/Properties/Resources.Designer.cs b/src/Common/Commands.Common.Authentication.Abstractions/Properties/Resources.Designer.cs index e51ea2407b42..0f1eb3465aee 100644 --- a/src/Common/Commands.Common.Authentication.Abstractions/Properties/Resources.Designer.cs +++ b/src/Common/Commands.Common.Authentication.Abstractions/Properties/Resources.Designer.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions.Properties { using System; - using System.Reflection; /// @@ -40,7 +39,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Commands.Common.Authentication.Abstractions.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Commands.Common.Authentication.Abstractions.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; @@ -97,6 +96,15 @@ internal static string InvalidDnsName { } } + /// + /// Looks up a localized string similar to {0} is invalid or empty.. + /// + internal static string InvalidOrEmptyArgumentMessage { + get { + return ResourceManager.GetString("InvalidOrEmptyArgumentMessage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Please connect to internet before executing this cmdlet. /// @@ -106,6 +114,15 @@ internal static string NoInternetConnection { } } + /// + /// Looks up a localized string similar to Path {0} doesn't exist.. + /// + internal static string PathDoesNotExist { + get { + return ResourceManager.GetString("PathDoesNotExist", resourceCulture); + } + } + /// /// Looks up a localized string similar to Attempted to read from the Azure PowerShell context after it was disposed. Please reload the module and try this operation again.. /// @@ -213,5 +230,14 @@ internal static string SessionNotInitialized { return ResourceManager.GetString("SessionNotInitialized", resourceCulture); } } + + /// + /// Looks up a localized string similar to (x86). + /// + internal static string x86InProgramFiles { + get { + return ResourceManager.GetString("x86InProgramFiles", resourceCulture); + } + } } } diff --git a/src/Common/Commands.Common.Authentication.Abstractions/Properties/Resources.resx b/src/Common/Commands.Common.Authentication.Abstractions/Properties/Resources.resx index be253a717354..9a23e626382d 100644 --- a/src/Common/Commands.Common.Authentication.Abstractions/Properties/Resources.resx +++ b/src/Common/Commands.Common.Authentication.Abstractions/Properties/Resources.resx @@ -129,9 +129,15 @@ "{0}" is an invalid DNS name for {1} + + {0} is invalid or empty. + Please connect to internet before executing this cmdlet + + Path {0} doesn't exist. + Attempted to read from the Azure PowerShell context after it was disposed. Please reload the module and try this operation again. @@ -168,4 +174,7 @@ The Azure PowerShell session has not been properly initialized. Please import the module and try again. + + (x86) + \ No newline at end of file diff --git a/src/Common/Commands.Common/Utilities/FileUtilities.cs b/src/Common/Commands.Common.Authentication.Abstractions/Utilities/FileUtilities.cs similarity index 91% rename from src/Common/Commands.Common/Utilities/FileUtilities.cs rename to src/Common/Commands.Common.Authentication.Abstractions/Utilities/FileUtilities.cs index 2b0d0075eb13..17bf65000d8a 100644 --- a/src/Common/Commands.Common/Utilities/FileUtilities.cs +++ b/src/Common/Commands.Common.Authentication.Abstractions/Utilities/FileUtilities.cs @@ -12,10 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Commands.Common.Authentication; -using Microsoft.Azure.Commands.Common.Authentication.Abstractions; -using Microsoft.Azure.Commands.Common.Authentication.Models; -using Microsoft.WindowsAzure.Commands.Common.Properties; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions.Properties; using System; using System.Diagnostics; using System.IO; @@ -23,7 +20,7 @@ using System.Reflection; using System.Text; -namespace Microsoft.WindowsAzure.Commands.Common +namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions { /// /// File utilities using the data store @@ -111,7 +108,7 @@ public static string GetWithProgramFilesPath(string directoryName, bool throwIfN programFilesPath += Resources.x86InProgramFiles; if (throwIfNotFound) { - Validate.ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName)); + ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName)); } return Path.Combine(programFilesPath, directoryName); } @@ -120,7 +117,7 @@ public static string GetWithProgramFilesPath(string directoryName, bool throwIfN programFilesPath = programFilesPath.Replace(Resources.x86InProgramFiles, String.Empty); if (throwIfNotFound) { - Validate.ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName)); + ValidateDirectoryExists(Path.Combine(programFilesPath, directoryName)); } return Path.Combine(programFilesPath, directoryName); } @@ -167,7 +164,7 @@ public static void DirectoryCopy(string sourceDirName, string destDirName, bool /// The path to the file that will be created public static void EnsureDirectoryExists(string pathName) { - Validate.ValidateStringIsNullOrEmpty(pathName, "Settings directory"); + ValidateStringIsNullOrEmpty(pathName, "Settings directory"); string directoryPath = Path.GetDirectoryName(pathName); if (!DataStore.DirectoryExists(directoryPath)) { @@ -368,5 +365,34 @@ public static string GetModuleFolderName(AzureModule module) { return module.ToString().Replace("Azure", ""); } + + private static void ValidateDirectoryExists(string directory, string exceptionMessage = null) + { + string msg = string.Format(Resources.PathDoesNotExist, directory); + if (!DataStore.DirectoryExists(directory)) + { + if (!string.IsNullOrEmpty(exceptionMessage)) + { + msg = exceptionMessage; + } + + throw new FileNotFoundException(msg); + } + } + + private static void ValidateStringIsNullOrEmpty(string data, string messageData, bool useDefaultMessage = true) + { + if (string.IsNullOrEmpty(data)) + { + if (useDefaultMessage) + { + throw new ArgumentException(string.Format(Resources.InvalidOrEmptyArgumentMessage, messageData)); + } + else + { + throw new ArgumentException(messageData); + } + } + } } } diff --git a/src/Common/Commands.Common.Authentication/Authentication/KeyStoreApplicationCredentialProvider.cs b/src/Common/Commands.Common.Authentication/Authentication/KeyStoreApplicationCredentialProvider.cs index 4c9323e0fcce..760b693f4fc6 100644 --- a/src/Common/Commands.Common.Authentication/Authentication/KeyStoreApplicationCredentialProvider.cs +++ b/src/Common/Commands.Common.Authentication/Authentication/KeyStoreApplicationCredentialProvider.cs @@ -14,7 +14,6 @@ using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.Rest.Azure.Authentication; -using Microsoft.WindowsAzure.Commands.Common; using System.Security; using System.Threading.Tasks; diff --git a/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalTokenProvider.cs b/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalTokenProvider.cs index afd3d163c031..4e4bcd521112 100644 --- a/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalTokenProvider.cs +++ b/src/Common/Commands.Common.Authentication/Authentication/ServicePrincipalTokenProvider.cs @@ -16,7 +16,6 @@ using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.Rest.Azure.Authentication; -using Microsoft.WindowsAzure.Commands.Common; using System; using System.Collections.Generic; using System.Security; diff --git a/src/Common/Commands.Common.Authentication/AzureSessionInitializer.cs b/src/Common/Commands.Common.Authentication/AzureSessionInitializer.cs index ea284fc3973e..6d5533b707df 100644 --- a/src/Common/Commands.Common.Authentication/AzureSessionInitializer.cs +++ b/src/Common/Commands.Common.Authentication/AzureSessionInitializer.cs @@ -16,7 +16,6 @@ using Microsoft.Azure.Commands.Common.Authentication.Factories; using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.IdentityModel.Clients.ActiveDirectory; -using Microsoft.WindowsAzure.Commands.Common; using System; using System.IO; using System.Diagnostics; diff --git a/src/Common/Commands.Common.Authentication/Commands.Common.Authentication.csproj b/src/Common/Commands.Common.Authentication/Commands.Common.Authentication.csproj index 4b239083baa2..c77c527d8d45 100644 --- a/src/Common/Commands.Common.Authentication/Commands.Common.Authentication.csproj +++ b/src/Common/Commands.Common.Authentication/Commands.Common.Authentication.csproj @@ -163,10 +163,6 @@ {70527617-7598-4aef-b5bd-db9186b8184b} Commands.Common.Authentication.Abstractions - - {5ee72c53-1720-4309-b54b-5fb79703195f} - Commands.Common - diff --git a/src/Common/Commands.Common.Authentication/Models/MemoryDataStore.cs b/src/Common/Commands.Common.Authentication/Models/MemoryDataStore.cs index f46fb46bead2..c82516f5661e 100644 --- a/src/Common/Commands.Common.Authentication/Models/MemoryDataStore.cs +++ b/src/Common/Commands.Common.Authentication/Models/MemoryDataStore.cs @@ -13,7 +13,6 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Common.Authentication.Abstractions; -using Microsoft.WindowsAzure.Commands.Common; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj index f81a695e703a..082e00090037 100644 --- a/src/Common/Commands.Common/Commands.Common.csproj +++ b/src/Common/Commands.Common/Commands.Common.csproj @@ -122,12 +122,10 @@ - - diff --git a/src/Common/Commands.Common/Utilities/Validate.cs b/src/Common/Commands.Common/Utilities/Validate.cs index 211c7200cd21..1b9f57f4f211 100644 --- a/src/Common/Commands.Common/Utilities/Validate.cs +++ b/src/Common/Commands.Common/Utilities/Validate.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Commands.Common.Authentication; using System; using System.Diagnostics.CodeAnalysis; using System.IO; @@ -21,6 +20,7 @@ using System.Net.Sockets; using System.Runtime.InteropServices; using Microsoft.WindowsAzure.Commands.Common.Properties; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Common { From c2c4704fcc20672d5b27046154179f6502d7bf2e Mon Sep 17 00:00:00 2001 From: cormacpayne Date: Wed, 13 Sep 2017 10:07:23 -0700 Subject: [PATCH 2/6] Add using for Authentication library --- .../Models/AsAzureAuthenticationProvider.cs | 1 + .../Cdn/Commands.Cdn/CustomDomain/NewAzureRmCdnCustomDomain.cs | 1 + .../ManagementCommands/EnableAzureHDInsightOMSCommand.cs | 1 + .../GetAzureApplicationGatewayAvailableWafRuleSets.cs | 1 + ...AzureOperationalInsightsAzureActivityLogDataSourceCommand.cs | 1 + ...oveAzureRmRecoveryServicesAsrStorageClassificationMapping.cs | 1 + .../Vault/GetAzureRmRecoveryServicesBackupProperty.cs | 1 + .../CmdletBase/ResourceWithParameterCmdletBase.cs | 1 + .../Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs | 1 + .../Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs | 1 + .../Cmdlets/Implementation/Policy/SetAzurePolicyDefinition.cs | 1 + .../Commands.ResourceManager/Cmdlets/Utilities/FileUtility.cs | 1 + .../Cmdlets/Utilities/TemplateUtility.cs | 1 + .../Commands/NewAzureRmServiceFabricCluster.cs | 1 + .../Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs | 1 + .../Cmdlets/DeploymentSlots/SwitchAzureWebAppSlot.cs | 1 + .../Common/Commands.Common.Test/Common/Data.cs | 1 + .../Common/Commands.Common.Test/Common/GeneralTests.cs | 1 + .../Common/Commands.ScenarioTest/Common/PowerShellTest.cs | 1 + .../FunctionalTests/GenericIaaSExtensionTests.cs | 1 + .../IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs | 1 + .../Service/CreateAzureSiteRecoveryRecoveryPlan.cs | 2 +- .../Services/Commands.Test.Utilities/Common/AzureAssert.cs | 1 + .../Services/Commands.Test.Utilities/Common/FileSystemHelper.cs | 1 + .../Development/DisableAzureRemoteDesktopCommandTest.cs | 1 + .../Development/EnableAzureRemoteDesktopCommandTest.cs | 1 + .../Development/SaveAzureServiceProjectPackageTests.cs | 1 + .../Commands.Test/CloudService/Utilities/AzureServiceTests.cs | 1 + .../Commands.Test/CloudService/Utilities/ScaffoldTests.cs | 1 + .../Services/Commands.Utilities/Common/AzureTools/CsPack.cs | 1 + .../Services/Commands.Utilities/Common/CommonUtilities.cs | 1 + .../Commands.Utilities/Common/JavaScriptPackageHelpers.cs | 1 + .../Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs | 1 + .../Services/Commands.Utilities/Websites/Services/Cache.cs | 1 + .../Websites/Services/LinkedRevisionControl.cs | 1 + .../Development/Scaffolding/NewAzureRoleTemplate.cs | 1 + .../Services/Commands/Websites/NewAzureWebSite.cs | 1 + .../FunctionalTests/OutputFormatValidator.cs | 1 + 38 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/Models/AsAzureAuthenticationProvider.cs b/src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/Models/AsAzureAuthenticationProvider.cs index cc07bd55b965..917b9934d888 100644 --- a/src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/Models/AsAzureAuthenticationProvider.cs +++ b/src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/Models/AsAzureAuthenticationProvider.cs @@ -22,6 +22,7 @@ using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Common.Properties; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.Azure.Commands.AnalysisServices.Dataplane.Models { diff --git a/src/ResourceManager/Cdn/Commands.Cdn/CustomDomain/NewAzureRmCdnCustomDomain.cs b/src/ResourceManager/Cdn/Commands.Cdn/CustomDomain/NewAzureRmCdnCustomDomain.cs index 56b42f5ce89a..6cdc86bac68c 100644 --- a/src/ResourceManager/Cdn/Commands.Cdn/CustomDomain/NewAzureRmCdnCustomDomain.cs +++ b/src/ResourceManager/Cdn/Commands.Cdn/CustomDomain/NewAzureRmCdnCustomDomain.cs @@ -27,6 +27,7 @@ using Microsoft.Azure.Commands.Cdn.Models.Endpoint; using System.Linq; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.Azure.Commands.Cdn.CustomDomain { diff --git a/src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/EnableAzureHDInsightOMSCommand.cs b/src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/EnableAzureHDInsightOMSCommand.cs index 68a266542139..e529f65094ad 100644 --- a/src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/EnableAzureHDInsightOMSCommand.cs +++ b/src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/EnableAzureHDInsightOMSCommand.cs @@ -18,6 +18,7 @@ using System.Management.Automation; using System.IO; using System.Reflection; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.Azure.Commands.HDInsight { diff --git a/src/ResourceManager/Network/Commands.Network/ApplicationGateway/GetAzureApplicationGatewayAvailableWafRuleSets.cs b/src/ResourceManager/Network/Commands.Network/ApplicationGateway/GetAzureApplicationGatewayAvailableWafRuleSets.cs index 3bff9b53e0d3..a57a1fe1f90a 100644 --- a/src/ResourceManager/Network/Commands.Network/ApplicationGateway/GetAzureApplicationGatewayAvailableWafRuleSets.cs +++ b/src/ResourceManager/Network/Commands.Network/ApplicationGateway/GetAzureApplicationGatewayAvailableWafRuleSets.cs @@ -14,6 +14,7 @@ using AutoMapper; using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.Network.Models; using Microsoft.Azure.Management.Network; using Microsoft.WindowsAzure.Commands.Common; diff --git a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/DataSources/NewDataSourceCmdletsPerKind/NewAzureOperationalInsightsAzureActivityLogDataSourceCommand.cs b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/DataSources/NewDataSourceCmdletsPerKind/NewAzureOperationalInsightsAzureActivityLogDataSourceCommand.cs index bf7c39606abf..82deea5f3bee 100644 --- a/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/DataSources/NewDataSourceCmdletsPerKind/NewAzureOperationalInsightsAzureActivityLogDataSourceCommand.cs +++ b/src/ResourceManager/OperationalInsights/Commands.OperationalInsights/DataSources/NewDataSourceCmdletsPerKind/NewAzureOperationalInsightsAzureActivityLogDataSourceCommand.cs @@ -22,6 +22,7 @@ using System.Reflection; using System.Management.Automation; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.Azure.Commands.OperationalInsights { diff --git a/src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/Storage/Classification/RemoveAzureRmRecoveryServicesAsrStorageClassificationMapping.cs b/src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/Storage/Classification/RemoveAzureRmRecoveryServicesAsrStorageClassificationMapping.cs index e4eff1f92319..2919abcb4000 100644 --- a/src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/Storage/Classification/RemoveAzureRmRecoveryServicesAsrStorageClassificationMapping.cs +++ b/src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/Storage/Classification/RemoveAzureRmRecoveryServicesAsrStorageClassificationMapping.cs @@ -18,6 +18,7 @@ using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.Azure.Commands.RecoveryServices.SiteRecovery { diff --git a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/GetAzureRmRecoveryServicesBackupProperty.cs b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/GetAzureRmRecoveryServicesBackupProperty.cs index af20df710fab..19cc730df12f 100644 --- a/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/GetAzureRmRecoveryServicesBackupProperty.cs +++ b/src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/GetAzureRmRecoveryServicesBackupProperty.cs @@ -19,6 +19,7 @@ using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Management.RecoveryServices.Models; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.Azure.Commands.RecoveryServices { diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/CmdletBase/ResourceWithParameterCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/CmdletBase/ResourceWithParameterCmdletBase.cs index b887dcd3d833..c1932c181234 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/CmdletBase/ResourceWithParameterCmdletBase.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/CmdletBase/ResourceWithParameterCmdletBase.cs @@ -13,6 +13,7 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs index 6fb43b159295..1186c404d7db 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs @@ -25,6 +25,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation using System.Linq; using System.Collections; using WindowsAzure.Commands.Common; + using Commands.Common.Authentication.Abstractions; /// /// Creates a policy assignment. diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs index f91d1c51e3a2..10282f480b62 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation { + using Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyDefinition.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyDefinition.cs index ec57e1611e1e..8599bf0f9d52 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyDefinition.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyDefinition.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation { + using Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Utilities/FileUtility.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Utilities/FileUtility.cs index 3c8f11bc4729..e382043e9687 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Utilities/FileUtility.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Utilities/FileUtility.cs @@ -14,6 +14,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities { + using Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.Common.Authentication; using System; using System.IO; diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Utilities/TemplateUtility.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Utilities/TemplateUtility.cs index 1ff5c62dca1a..8eee557bab2d 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Utilities/TemplateUtility.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Utilities/TemplateUtility.cs @@ -25,6 +25,7 @@ using System.Diagnostics; using System.Security; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities { diff --git a/src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/NewAzureRmServiceFabricCluster.cs b/src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/NewAzureRmServiceFabricCluster.cs index b3055631247d..0cc08bb81ef7 100644 --- a/src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/NewAzureRmServiceFabricCluster.cs +++ b/src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/NewAzureRmServiceFabricCluster.cs @@ -33,6 +33,7 @@ using Microsoft.WindowsAzure.Commands.Common; using Newtonsoft.Json; using OperatingSystem = Microsoft.Azure.Commands.ServiceFabric.Models.OperatingSystem; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.Azure.Commands.ServiceFabric.Commands { diff --git a/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs b/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs index 735dc6eb8013..9fd5f3d85408 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Server/Cmdlet/GetAzureSqlServer.cs @@ -13,6 +13,7 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.Sql.Server.Model; using Microsoft.WindowsAzure.Commands.Common; using System.Collections.Generic; diff --git a/src/ResourceManager/Websites/Commands.Websites/Cmdlets/DeploymentSlots/SwitchAzureWebAppSlot.cs b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/DeploymentSlots/SwitchAzureWebAppSlot.cs index adc654fcbc80..41337301d6a8 100644 --- a/src/ResourceManager/Websites/Commands.Websites/Cmdlets/DeploymentSlots/SwitchAzureWebAppSlot.cs +++ b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/DeploymentSlots/SwitchAzureWebAppSlot.cs @@ -22,6 +22,7 @@ using Microsoft.WindowsAzure.Commands.Common; using System; using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.Azure.Commands.WebApps.Cmdlets.DeploymentSlots { diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/Data.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/Data.cs index d6a699657483..abd568e6c7e2 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/Data.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/Data.cs @@ -21,6 +21,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/ServiceManagement/Common/Commands.Common.Test/Common/GeneralTests.cs b/src/ServiceManagement/Common/Commands.Common.Test/Common/GeneralTests.cs index f74d98baf2ae..1c4c009b9950 100644 --- a/src/ServiceManagement/Common/Commands.Common.Test/Common/GeneralTests.cs +++ b/src/ServiceManagement/Common/Commands.Common.Test/Common/GeneralTests.cs @@ -20,6 +20,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit.Abstractions; using Microsoft.WindowsAzure.ServiceManagemenet.Common.Models; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Common.Test.Common { diff --git a/src/ServiceManagement/Common/Commands.ScenarioTest/Common/PowerShellTest.cs b/src/ServiceManagement/Common/Commands.ScenarioTest/Common/PowerShellTest.cs index 4d5d48504f62..c17e895fd21d 100644 --- a/src/ServiceManagement/Common/Commands.ScenarioTest/Common/PowerShellTest.cs +++ b/src/ServiceManagement/Common/Commands.ScenarioTest/Common/PowerShellTest.cs @@ -22,6 +22,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.ScenarioTest.Common { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs index d2ec1a0a6fad..0ba9a838a677 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/GenericIaaSExtensionTests.cs @@ -24,6 +24,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs index a118514fe6e5..6dce4293775f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Common/VirtualMachineExtensionCmdletBase.cs @@ -13,6 +13,7 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers; using Microsoft.WindowsAzure.Commands.ServiceManagement.Model; diff --git a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs index 78252fd06faf..21d9df621a66 100644 --- a/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs +++ b/src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryRecoveryPlan.cs @@ -14,8 +14,8 @@ using System; using System.Management.Automation; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.RecoveryServices.SiteRecovery; -using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Management.SiteRecovery.Models; namespace Microsoft.Azure.Commands.RecoveryServices diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs index 4c4d5643ca7b..b10fe5c3dc55 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/AzureAssert.cs @@ -28,6 +28,7 @@ namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common using DefinitionConfigurationSetting = Commands.Utilities.Common.XmlSchema.ServiceDefinitionSchema.ConfigurationSetting; using Microsoft.Azure.Commands.Common.Authentication; using Commands.Common; + using Azure.Commands.Common.Authentication.Abstractions; public static class AzureAssert { diff --git a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs index 1ab6636dd8ce..e6a8626d730a 100644 --- a/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs +++ b/src/ServiceManagement/Services/Commands.Test.Utilities/Common/FileSystemHelper.cs @@ -21,6 +21,7 @@ using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.ServiceManagemenet.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs index ba8edce172e5..deae5e0a894b 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/DisableAzureRemoteDesktopCommandTest.cs @@ -25,6 +25,7 @@ using Xunit; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.Common.Authentication.Models; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs index 280821e377ed..552a2458c06c 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/EnableAzureRemoteDesktopCommandTest.cs @@ -28,6 +28,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs index 71f42bcf3e63..f7d0f615e098 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Development/SaveAzureServiceProjectPackageTests.cs @@ -26,6 +26,7 @@ using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Development { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs index 1348ced88b69..495ab95135ed 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs @@ -28,6 +28,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { diff --git a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs index 06d1132855ee..f77ca2be4923 100644 --- a/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/ScaffoldTests.cs @@ -20,6 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Test.CloudService.Utilities { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs index a29e5814c4bb..510a2fb91f6b 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/CsPack.cs @@ -24,6 +24,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.AzureTools { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs index 61f714f9f039..174c21e4ba1e 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/CommonUtilities.cs @@ -19,6 +19,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Utilities.Common { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs index bfb11195ce6c..68a3c77e260e 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/JavaScriptPackageHelpers.cs @@ -20,6 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs index 10998ba7b9b8..df60f27890f9 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Common/Scaffolding/Scaffold.cs @@ -22,6 +22,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.Scaffolding { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs index 70a343b0e0b4..44593e84f3b6 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/Cache.cs @@ -20,6 +20,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Utilities.Websites.Services { diff --git a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs index 8c5cd0871275..842662ba531d 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs +++ b/src/ServiceManagement/Services/Commands.Utilities/Websites/Services/LinkedRevisionControl.cs @@ -19,6 +19,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.Utilities.Websites.Services { diff --git a/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs b/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs index 10f8118992d9..c1e8934273f2 100644 --- a/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs +++ b/src/ServiceManagement/Services/Commands/CloudService/Development/Scaffolding/NewAzureRoleTemplate.cs @@ -21,6 +21,7 @@ using Microsoft.WindowsAzure.Commands.Utilities.Properties; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.CloudService.Development.Scaffolding { diff --git a/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs b/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs index 05b33e1165e5..ffdd9e2f8023 100644 --- a/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs +++ b/src/ServiceManagement/Services/Commands/Websites/NewAzureWebSite.cs @@ -35,6 +35,7 @@ namespace Microsoft.WindowsAzure.Commands.Websites using Microsoft.Azure.Commands.Common.Authentication; using Hyak.Common; using Common; + using Azure.Commands.Common.Authentication.Abstractions; /// /// Creates a new azure website. diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs index 14076d895e95..fbec9baa2cbb 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase.Test/FunctionalTests/OutputFormatValidator.cs @@ -16,6 +16,7 @@ using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; namespace Microsoft.WindowsAzure.Commands.SqlDatabase.Test.FunctionalTests { From 71c7b9017bd129b5e5bbc66cb68c2ae7841b19ae Mon Sep 17 00:00:00 2001 From: cormacpayne Date: Wed, 4 Oct 2017 09:31:40 -0700 Subject: [PATCH 3/6] Update common projects after merge --- .../AzurePSDataCollectionProfile.cs | 2 +- ...mmands.Common.Authentication.Abstractions.csproj | 2 ++ .../DataCollectionController.cs | 13 ++++++------- src/Common/Commands.Common/Commands.Common.csproj | 2 -- .../Commands.Common/Extensions/CmdletExtensions.cs | 1 + src/Common/Commands.Common/MetricHelper.cs | 1 + .../Profile/Commands.Profile.Test/TelemetryTests.cs | 1 + .../DataCollection/EnableAzureRMDataCollection.cs | 1 + 8 files changed, 13 insertions(+), 10 deletions(-) rename src/Common/{Commands.Common => Commands.Common.Authentication.Abstractions}/AzurePSDataCollectionProfile.cs (95%) rename src/Common/{Commands.Common => Commands.Common.Authentication.Abstractions}/DataCollectionController.cs (94%) diff --git a/src/Common/Commands.Common/AzurePSDataCollectionProfile.cs b/src/Common/Commands.Common.Authentication.Abstractions/AzurePSDataCollectionProfile.cs similarity index 95% rename from src/Common/Commands.Common/AzurePSDataCollectionProfile.cs rename to src/Common/Commands.Common.Authentication.Abstractions/AzurePSDataCollectionProfile.cs index d4a27f2711eb..1297bd808c1c 100644 --- a/src/Common/Commands.Common/AzurePSDataCollectionProfile.cs +++ b/src/Common/Commands.Common.Authentication.Abstractions/AzurePSDataCollectionProfile.cs @@ -15,7 +15,7 @@ using Newtonsoft.Json; using System; -namespace Microsoft.WindowsAzure.Commands.Common +namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions { public class AzurePSDataCollectionProfile { diff --git a/src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj b/src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj index aaa28ae924fe..e896be268ad6 100644 --- a/src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj +++ b/src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj @@ -101,9 +101,11 @@ + + diff --git a/src/Common/Commands.Common/DataCollectionController.cs b/src/Common/Commands.Common.Authentication.Abstractions/DataCollectionController.cs similarity index 94% rename from src/Common/Commands.Common/DataCollectionController.cs rename to src/Common/Commands.Common.Authentication.Abstractions/DataCollectionController.cs index 3626eed2ce67..940c78a8b576 100644 --- a/src/Common/Commands.Common/DataCollectionController.cs +++ b/src/Common/Commands.Common.Authentication.Abstractions/DataCollectionController.cs @@ -1,9 +1,4 @@ -using Microsoft.Azure.Commands.Common.Authentication.Abstractions; -using Microsoft.WindowsAzure.Commands.Common.Properties; -using Newtonsoft.Json; -using System; -using System.IO; -// ---------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -namespace Microsoft.WindowsAzure.Commands.Common +using Newtonsoft.Json; +using System; +using System.IO; + +namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions { public abstract class DataCollectionController { diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj index fd5288f4557e..843a894951a2 100644 --- a/src/Common/Commands.Common/Commands.Common.csproj +++ b/src/Common/Commands.Common/Commands.Common.csproj @@ -122,7 +122,6 @@ - @@ -131,7 +130,6 @@ - diff --git a/src/Common/Commands.Common/Extensions/CmdletExtensions.cs b/src/Common/Commands.Common/Extensions/CmdletExtensions.cs index 18ab52618f0c..8304ab56c7dd 100644 --- a/src/Common/Commands.Common/Extensions/CmdletExtensions.cs +++ b/src/Common/Commands.Common/Extensions/CmdletExtensions.cs @@ -12,6 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.WindowsAzure.Commands.Common; using System; using System.Collections.Generic; diff --git a/src/Common/Commands.Common/MetricHelper.cs b/src/Common/Commands.Common/MetricHelper.cs index 0a370da0a624..6453494ff71e 100644 --- a/src/Common/Commands.Common/MetricHelper.cs +++ b/src/Common/Commands.Common/MetricHelper.cs @@ -15,6 +15,7 @@ using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.DataContracts; using Microsoft.ApplicationInsights.Extensibility; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.WindowsAzure.Commands.Common.Utilities; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; diff --git a/src/ResourceManager/Profile/Commands.Profile.Test/TelemetryTests.cs b/src/ResourceManager/Profile/Commands.Profile.Test/TelemetryTests.cs index 78fae53b34c6..c9c12e3e490b 100644 --- a/src/ResourceManager/Profile/Commands.Profile.Test/TelemetryTests.cs +++ b/src/ResourceManager/Profile/Commands.Profile.Test/TelemetryTests.cs @@ -13,6 +13,7 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.ScenarioTest; using Microsoft.WindowsAzure.Commands.Common; diff --git a/src/ResourceManager/Profile/Commands.Profile/DataCollection/EnableAzureRMDataCollection.cs b/src/ResourceManager/Profile/Commands.Profile/DataCollection/EnableAzureRMDataCollection.cs index f45db44d4180..2675ea073bf0 100644 --- a/src/ResourceManager/Profile/Commands.Profile/DataCollection/EnableAzureRMDataCollection.cs +++ b/src/ResourceManager/Profile/Commands.Profile/DataCollection/EnableAzureRMDataCollection.cs @@ -13,6 +13,7 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.Profile.Properties; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.WindowsAzure.Commands.Common; From 2f6ab26e9e07ce32a4bfcdbec61238980fb21915 Mon Sep 17 00:00:00 2001 From: cormacpayne Date: Wed, 4 Oct 2017 10:06:45 -0700 Subject: [PATCH 4/6] Additional updates after merge, update AzureRM.Profile.psd1 --- .../VirtualMachineRunCommandMethod.cs | 3 ++- .../Profile/AzureRM.Profile.psd1 | 21 +++++++++++++++++-- .../ManagedApplicationCmdletBase.cs | 1 + .../Implementation/Policy/PolicyCmdletBase.cs | 1 + .../Policy/SetAzurePolicySetDefinition.cs | 1 + .../EnableAzureDataCollection.cs | 1 + .../Blob/Cmdlet/StartAzureStorageBlobCopy.cs | 1 + 7 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachine/VirtualMachineRunCommandMethod.cs b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachine/VirtualMachineRunCommandMethod.cs index 5070907465bb..f21ef2c25ecd 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachine/VirtualMachineRunCommandMethod.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachine/VirtualMachineRunCommandMethod.cs @@ -20,6 +20,7 @@ // code is regenerated. using AutoMapper; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.Compute.Automation.Models; using Microsoft.Azure.Management.Compute; using Microsoft.Azure.Management.Compute.Models; @@ -132,7 +133,7 @@ protected override void ProcessRecord() parameters.Script = new List(); PathIntrinsics currentPath = SessionState.Path; var filePath = new System.IO.FileInfo(currentPath.GetUnresolvedProviderPathFromPSPath(this.ScriptPath)); - string fileContent = WindowsAzure.Commands.Common.FileUtilities.DataStore.ReadFileAsText(filePath.FullName); + string fileContent = FileUtilities.DataStore.ReadFileAsText(filePath.FullName); parameters.Script = fileContent.Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries); } if (this.Parameter != null) diff --git a/src/ResourceManager/Profile/AzureRM.Profile.psd1 b/src/ResourceManager/Profile/AzureRM.Profile.psd1 index 4ae57e6368bd..000b9e54cbc3 100644 --- a/src/ResourceManager/Profile/AzureRM.Profile.psd1 +++ b/src/ResourceManager/Profile/AzureRM.Profile.psd1 @@ -54,8 +54,25 @@ CLRVersion = '4.0' # RequiredModules = @() # Assemblies that must be loaded prior to importing this module -RequiredAssemblies = - '.\Microsoft.Azure.Commands.Common.Authentication.ResourceManager.dll' +RequiredAssemblies = '.\Microsoft.Azure.Commands.Common.Authentication.Abstractions.dll', + '.\Microsoft.Azure.Commands.Common.Authentication.dll', + '.\Microsoft.Azure.Commands.Common.Authentication.ResourceManager.dll', + '.\Microsoft.Azure.Commands.ResourceManager.Common.dll', + '.\Microsoft.WindowsAzure.Commands.Common.dll', + '.\Hyak.Common.dll', + '.\Microsoft.ApplicationInsights.dll', + '.\Microsoft.Azure.Common.dll', + '.\Microsoft.Azure.Common.NetFramework.dll', + '.\Microsoft.Azure.KeyVault.Core.dll', + '.\Microsoft.Rest.ClientRuntime.dll', + '.\Microsoft.Rest.ClientRuntime.Azure.dll', + '.\Microsoft.Threading.Tasks.dll', + '.\Microsoft.Threading.Tasks.Extensions.dll', + '.\Microsoft.Threading.Tasks.Extensions.Desktop.dll', + '.\Microsoft.WindowsAzure.Management.dll', + '.\Newtonsoft.Json.dll', + '.\System.Net.Http.Extensions.dll', + '.\System.Net.Http.Primitives.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ManagedApplications/ManagedApplicationCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ManagedApplications/ManagedApplicationCmdletBase.cs index 2f51df0d750d..26ffaf5b1cb1 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ManagedApplications/ManagedApplicationCmdletBase.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ManagedApplications/ManagedApplicationCmdletBase.cs @@ -27,6 +27,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation using Microsoft.WindowsAzure.Commands.Common; using System.Collections.Generic; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Application; + using Commands.Common.Authentication.Abstractions; /// /// Base class for policy assignment cmdlets. diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyCmdletBase.cs index 1d70447ba993..736f62dbe31a 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyCmdletBase.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyCmdletBase.cs @@ -25,6 +25,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation using System.Linq; using System.Management.Automation; using System.Threading.Tasks; + using Commands.Common.Authentication.Abstractions; /// /// Base class for policy cmdlets. diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicySetDefinition.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicySetDefinition.cs index e731c5cd82a6..d15205611130 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicySetDefinition.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicySetDefinition.cs @@ -14,6 +14,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation { + using Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; diff --git a/src/ServiceManagement/Profile/Commands.Profile/DataCollection/EnableAzureDataCollection.cs b/src/ServiceManagement/Profile/Commands.Profile/DataCollection/EnableAzureDataCollection.cs index cb0487b848d2..d0805dd3fca5 100644 --- a/src/ServiceManagement/Profile/Commands.Profile/DataCollection/EnableAzureDataCollection.cs +++ b/src/ServiceManagement/Profile/Commands.Profile/DataCollection/EnableAzureDataCollection.cs @@ -13,6 +13,7 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System.Management.Automation; diff --git a/src/Storage/Stack/Commands.Storage/Blob/Cmdlet/StartAzureStorageBlobCopy.cs b/src/Storage/Stack/Commands.Storage/Blob/Cmdlet/StartAzureStorageBlobCopy.cs index 332cb7e735cf..89740c1b3d4d 100644 --- a/src/Storage/Stack/Commands.Storage/Blob/Cmdlet/StartAzureStorageBlobCopy.cs +++ b/src/Storage/Stack/Commands.Storage/Blob/Cmdlet/StartAzureStorageBlobCopy.cs @@ -33,6 +33,7 @@ namespace Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet using Microsoft.WindowsAzure.Storage.File; using Microsoft.Azure.Commands.Common.Authentication; using System.Reflection; + using Azure.Commands.Common.Authentication.Abstractions; [Cmdlet(VerbsLifecycle.Start, StorageNouns.CopyBlob, ConfirmImpact = ConfirmImpact.High, DefaultParameterSetName = ContainerNameParameterSet), OutputType(typeof(AzureStorageBlob))] From 7bab281b16ff4b425bf9d773e41b4fbb3eb1f09c Mon Sep 17 00:00:00 2001 From: cormacpayne Date: Wed, 4 Oct 2017 15:31:29 -0700 Subject: [PATCH 5/6] Remove psm1 transform logic --- build.proj | 16 +---- tools/PublishModules.ps1 | 150 --------------------------------------- tools/UpdateModules.ps1 | 148 -------------------------------------- 3 files changed, 1 insertion(+), 313 deletions(-) delete mode 100644 tools/UpdateModules.ps1 diff --git a/build.proj b/build.proj index 8ea4a7043dae..ba818c1a6c17 100644 --- a/build.proj +++ b/build.proj @@ -209,23 +209,15 @@ Condition=" '$(SkipHelp)' == 'false' and '$(Latest)' == 'true'"/> - - - + - - - - - - diff --git a/tools/PublishModules.ps1 b/tools/PublishModules.ps1 index 3e88b1037c09..18c04df9faa4 100644 --- a/tools/PublishModules.ps1 +++ b/tools/PublishModules.ps1 @@ -110,148 +110,6 @@ function Get-TargetModules } } -function Make-StrictModuleDependencies -{ - [CmdletBinding()] - param( - [string] $Path) - - PROCESS - { - $manifest = Test-ModuleManifest -Path $Path - $newModules = @() - foreach ($module in $manifest.RequiredModules) - { - $newModules += (@{ModuleName = $module.Name; RequiredVersion= $module.Version}) - } - - if ($newModules.Count -gt 0) - { - Update-ModuleManifest -Path $Path -RequiredModules $newModules - } - - } - -} - -function Add-PSM1Dependency -{ - [CmdletBinding()] - param( - [string] $Path) - - PROCESS - { - $file = Get-Item -Path $Path - $manifestFile = $file.Name - $psm1file = $manifestFile -replace ".psd1", ".psm1" - $manifest = Test-ModuleManifest -Path $Path - if($isNetCore -eq "false") { - Update-ModuleManifest -Path $Path -RootModule $psm1file - } - } - -} - - -function Remove-ModuleDependencies -{ - [CmdletBinding()] - param( - [string] $Path) - - PROCESS - { - $regex = New-Object System.Text.RegularExpressions.Regex "RequiredModules\s*=\s*@\([^\)]+\)" - $content = (Get-Content -Path $Path) -join "`r`n" - $text = $regex.Replace($content, "RequiredModules = @()") - $text | Out-File -FilePath $Path - - } - -} - -function Update-NugetPackage -{ - [CmdletBinding()] - param( - [string]$BasePath, - [string]$ModuleName, - [string]$DirPath, - [string]$NugetExe - ) - - PROCESS - { - $regex = New-Object -Type System.Text.RegularExpressions.Regex -ArgumentList "([0-9\.]+)nupkg$" - $regex2 = "false" - - $relDir = Join-Path $DirPath -ChildPath "_rels" - $contentPath = Join-Path $DirPath -ChildPath '`[Content_Types`].xml' - $packPath = Join-Path $DirPath -ChildPath "package" - $modulePath = Join-Path $DirPath -ChildPath ($ModuleName + ".nuspec") - Remove-Item -Recurse -Path $relDir -Force - Remove-Item -Recurse -Path $packPath -Force - Remove-Item -Path $contentPath -Force - $content = (Get-Content -Path $modulePath) -join "`r`n" - $content = $content -replace $regex2, ("https://raw.githubusercontent.com/Azure/azure-powershell/dev/LICENSE.txt`r`n https://github.com/Azure/azure-powershell`r`n true") - $content | Out-File -FilePath $modulePath -Force - &$NugetExe pack $modulePath -OutputDirectory $BasePath - } -} - -function Change-RMModule -{ - [CmdletBinding()] - param( - [string]$Path, - [string]$RepoLocation, - [string]$TempRepo, - [string]$TempRepoPath, - [string]$NugetExe - ) - - PROCESS - { - $moduleName = (Get-Item -Path $Path).Name - $moduleManifest = $moduleName + ".psd1" - $moduleSourcePath = Join-Path -Path $Path -ChildPath $moduleManifest - $manifest = Make-StrictModuleDependencies $moduleSourcePath - $manifest = Test-ModuleManifest -Path $moduleSourcePath - $toss = Publish-Module -Path $Path -Repository $TempRepo -Force - Write-Output "Changing to directory for module modifications $TempRepoPath" - pushd $TempRepoPath - try - { - $nupkgPath = Join-Path -Path . -ChildPath ($moduleName + "." + $manifest.Version.ToString() + ".nupkg") - $zipPath = Join-Path -Path . -ChildPath ($moduleName + "." + $manifest.Version.ToString() + ".zip") - $dirPath = Join-Path -Path . -ChildPath $moduleName - $unzippedManifest = Join-Path -Path $dirPath -ChildPath ($moduleName + ".psd1") - - if (!(Test-Path -Path $nupkgPath)) - { - throw "Module at $nupkgPath in $TempRepoPath does not exist" - } - Write-Output "Renaming package $nupkgPath to zip archive $zipPath" - ren $nupkgPath $zipPath - Write-Output "Expanding $zipPath" - Expand-Archive $zipPath -DestinationPath $dirPath - Write-Output "Adding PSM1 dependency to $unzippedManifest" - Add-PSM1Dependency -Path $unzippedManifest - Write-Output "Removing module manifest dependencies for $unzippedManifest" - Remove-ModuleDependencies -Path $unzippedManifest - - Remove-Item -Path $zipPath -Force - Write-Output "Repackaging $dirPath" - Update-NugetPackage -BasePath $TempRepoPath -ModuleName $moduleName -DirPath $dirPath -NugetExe $NugetExe - } - finally - { - popd - } - } -} - function Publish-RMModule { [CmdletBinding()] @@ -341,14 +199,6 @@ $env:PSModulePath="$env:PSModulePath;$tempRepoPath" try { $modulesInScope = Get-TargetModules -buildConfig $buildConfig -Scope $scope -PublishLocal $publishToLocal -Profile $Profile - foreach ($modulePath in $modulesInScope) { - # filter out AzureRM.Profile which always gets published first - # And "Azure.Storage" which is built out as test dependencies - $module = Get-Item -Path $modulePath - Write-Host "Changing $module module from $modulePath" - Change-RMModule -Path $modulePath -RepoLocation $repositoryLocation -TempRepo $tempRepoName -TempRepoPath $tempRepoPath -nugetExe $nugetExe - Write-Host "Changed $module module" - } if (!$publishToLocal) { diff --git a/tools/UpdateModules.ps1 b/tools/UpdateModules.ps1 deleted file mode 100644 index 22959c4dbb10..000000000000 --- a/tools/UpdateModules.ps1 +++ /dev/null @@ -1,148 +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. -# ---------------------------------------------------------------------------------- -param( - [Parameter(Mandatory = $false, Position = 0)] - [string] $buildConfig, - [Parameter(Mandatory = $false, Position = 1)] - [string] $scope, - [Parameter(Mandatory=$false)] - [ValidateSet("Latest", "Stack")] - [string] $Profile = "Latest" -) - -function Create-ModulePsm1 -{ - [CmdletBinding()] - param( - [string]$ModulePath, - [string]$TemplatePath - ) - - PROCESS - { - $manifestDir = Get-Item -Path $ModulePath - $moduleName = $manifestDir.Name + ".psd1" - $manifestPath = Join-Path -Path $ModulePath -ChildPath $moduleName - $module = Test-ModuleManifest -Path $manifestPath - $templateOutputPath = $manifestPath -replace ".psd1", ".psm1" - [string]$strict - [string]$loose - foreach ($mod in $module.RequiredModules) - { - $strict += " Import-Module " + $mod.Name + " -RequiredVersion " + [string]$mod.Version + "`r`n" - $loose += " Import-Module " + $mod.Name + "`r`n" - } - $template = Get-Content -Path $TemplatePath - $template = $template -replace "%MODULE-NAME%", $module.Name - $template = $template -replace "%DATE%", [string](Get-Date) - $template = $template -replace "%STRICT-DEPENDENCIES%", $strict - $template = $template -replace "%DEPENDENCIES%", $loose - Write-Host "Writing psm1 manifest to $templateOutputPath" - $template | Out-File -FilePath $templateOutputPath -Force - $file = Get-Item -Path $templateOutputPath - } -} - -if ([string]::IsNullOrEmpty($buildConfig)) -{ - Write-Verbose "Setting build configuration to 'Release'" - $buildConfig = "Release" -} - -if ([string]::IsNullOrEmpty($scope)) -{ - Write-Verbose "Default scope to all" - $scope = 'All' -} - -Write-Host "Updating $scope package(and its dependencies)" - -$packageFolder = "$PSScriptRoot\..\src\Package" - -if ($Profile -eq "Stack") -{ - $packageFolder = "$PSScriptRoot\..\src\Stack" -} - - - -$resourceManagerRootFolder = "$packageFolder\$buildConfig\ResourceManager\AzureResourceManager" -$publishToLocal = test-path $repositoryLocation -$templateLocation = "$PSScriptRoot\AzureRM.Example.psm1" -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 "Updating profile module" - Create-ModulePsm1 -ModulePath "$resourceManagerRootFolder\AzureRM.Profile" -TemplatePath $templateLocation - Write-Host "Updated profile module" -} - -if (($scope -eq 'All') -or ($scope -eq 'AzureStorage')) { - $modulePath = "$packageFolder\$buildConfig\Storage\Azure.Storage" - # Publish AzureStorage module - Write-Host "Updating AzureStorage module from $modulePath" - Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation -} - -if (($scope -eq 'All') -or ($scope -eq 'ServiceManagement')) { - $modulePath = "$packageFolder\$buildConfig\ServiceManagement\Azure" - # Publish Azure module - Write-Host "Updating ServiceManagement(aka Azure) module from $modulePath" - Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation -} - -$resourceManagerModules = Get-ChildItem -Path $resourceManagerRootFolder -Directory -if ($scope -eq 'All') { - foreach ($module in $resourceManagerModules) { - # 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 "Updating $module module from $modulePath" - Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation - Write-Host "Updated $module module" - } - } -} elseif ($scope -ne 'AzureRM') { - $modulePath = Join-Path $resourceManagerRootFolder "AzureRM.$scope" - if (Test-Path $modulePath) { - Write-Host "Updating $scope module from $modulePath" - Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation - Write-Host "Updated $scope module" - } else { - Write-Error "Can not find module with name $scope to publish" - } -} - -if (($scope -eq 'All') -or ($scope -eq 'AzureRM')) { - # Update AzureRM module - if ($Profile -eq "Stack") - { - $modulePath = "$PSScriptRoot\..\src\StackAdmin\AzureRM" - Write-Host "Updating AzureRM module from $modulePath" - Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation - Write-Host "Updated AzureRM module" - $modulePath = "$PSScriptRoot\..\src\StackAdmin\AzureStack" - Write-Host "Updating AzureRM module from $modulePath" - Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation - Write-Host "Updated AzureStack module" - } - else { - $modulePath = "$PSScriptRoot\AzureRM" - Write-Host "Updating AzureRM module from $modulePath" - Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation - Write-Host "Updated Azure module" - } -} - - From a36a0de699febb6cd1d42dfb15db7141a9eeb8e4 Mon Sep 17 00:00:00 2001 From: cormacpayne Date: Wed, 4 Oct 2017 16:45:29 -0700 Subject: [PATCH 6/6] Revert a few changes made in PublishModules.ps1 --- tools/PublishModules.ps1 | 84 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/tools/PublishModules.ps1 b/tools/PublishModules.ps1 index 18c04df9faa4..05d82dc98d53 100644 --- a/tools/PublishModules.ps1 +++ b/tools/PublishModules.ps1 @@ -110,6 +110,82 @@ function Get-TargetModules } } +function Update-NugetPackage +{ + [CmdletBinding()] + param( + [string]$BasePath, + [string]$ModuleName, + [string]$DirPath, + [string]$NugetExe + ) + + PROCESS + { + $regex = New-Object -Type System.Text.RegularExpressions.Regex -ArgumentList "([0-9\.]+)nupkg$" + $regex2 = "false" + + $relDir = Join-Path $DirPath -ChildPath "_rels" + $contentPath = Join-Path $DirPath -ChildPath '`[Content_Types`].xml' + $packPath = Join-Path $DirPath -ChildPath "package" + $modulePath = Join-Path $DirPath -ChildPath ($ModuleName + ".nuspec") + Remove-Item -Recurse -Path $relDir -Force + Remove-Item -Recurse -Path $packPath -Force + Remove-Item -Path $contentPath -Force + $content = (Get-Content -Path $modulePath) -join "`r`n" + $content = $content -replace $regex2, ("https://raw.githubusercontent.com/Azure/azure-powershell/dev/LICENSE.txt`r`n https://github.com/Azure/azure-powershell`r`n true") + $content | Out-File -FilePath $modulePath -Force + &$NugetExe pack $modulePath -OutputDirectory $BasePath + } +} + +function Change-RMModule +{ + [CmdletBinding()] + param( + [string]$Path, + [string]$RepoLocation, + [string]$TempRepo, + [string]$TempRepoPath, + [string]$NugetExe + ) + + PROCESS + { + $moduleName = (Get-Item -Path $Path).Name + $moduleManifest = $moduleName + ".psd1" + $moduleSourcePath = Join-Path -Path $Path -ChildPath $moduleManifest + $manifest = Test-ModuleManifest -Path $moduleSourcePath + $toss = Publish-Module -Path $Path -Repository $TempRepo -Force + Write-Output "Changing to directory for module modifications $TempRepoPath" + pushd $TempRepoPath + try + { + $nupkgPath = Join-Path -Path . -ChildPath ($moduleName + "." + $manifest.Version.ToString() + ".nupkg") + $zipPath = Join-Path -Path . -ChildPath ($moduleName + "." + $manifest.Version.ToString() + ".zip") + $dirPath = Join-Path -Path . -ChildPath $moduleName + $unzippedManifest = Join-Path -Path $dirPath -ChildPath ($moduleName + ".psd1") + + if (!(Test-Path -Path $nupkgPath)) + { + throw "Module at $nupkgPath in $TempRepoPath does not exist" + } + Write-Output "Renaming package $nupkgPath to zip archive $zipPath" + ren $nupkgPath $zipPath + Write-Output "Expanding $zipPath" + Expand-Archive $zipPath -DestinationPath $dirPath + + Remove-Item -Path $zipPath -Force + Write-Output "Repackaging $dirPath" + Update-NugetPackage -BasePath $TempRepoPath -ModuleName $moduleName -DirPath $dirPath -NugetExe $NugetExe + } + finally + { + popd + } + } +} + function Publish-RMModule { [CmdletBinding()] @@ -199,6 +275,14 @@ $env:PSModulePath="$env:PSModulePath;$tempRepoPath" try { $modulesInScope = Get-TargetModules -buildConfig $buildConfig -Scope $scope -PublishLocal $publishToLocal -Profile $Profile + foreach ($modulePath in $modulesInScope) { + # filter out AzureRM.Profile which always gets published first + # And "Azure.Storage" which is built out as test dependencies + $module = Get-Item -Path $modulePath + Write-Host "Changing $module module from $modulePath" + Change-RMModule -Path $modulePath -RepoLocation $repositoryLocation -TempRepo $tempRepoName -TempRepoPath $tempRepoPath -nugetExe $nugetExe + Write-Host "Changed $module module" + } if (!$publishToLocal) {