Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,15 @@
Condition=" '$(SkipHelp)' == 'false' and '$(Latest)' == 'true'"/>
<CallTarget Targets="BuildSetupTest"/>
<!-- moved copy tasks -->

<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) $(Scope) -Profile Latest &quot; " Condition="'$(Latest)' == 'true' "/>
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) $(Scope) -Profile Stack &quot; " Condition="'$(Stack)' == 'true' "/>

<!-- Copying shortcut to be signed -->
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psd1"
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" Condition= " '$(NetCore)' == 'false' and '$(Latest)' == 'true'"/>
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psm1"
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" Condition= " '$(NetCore)' == 'false' and '$(Latest)' == 'true'"/>

<Copy SourceFiles="$(LibrarySourceFolder)\StackAdmin\AzureRM\AzureRM.psd1"
DestinationFolder="$(LibrarySourceFolder)\Stack\$(Configuration)" Condition= " '$(NetCore)' == 'false' and '$(Stack)' == 'true' "/>
<Copy SourceFiles="$(LibrarySourceFolder)\StackAdmin\AzureRM\AzureRM.psm1"
DestinationFolder="$(LibrarySourceFolder)\Stack\$(Configuration)" Condition= " '$(NetCore)' == 'false' and '$(Stack)' == 'true' "/>
<Copy SourceFiles="$(LibrarySourceFolder)\StackAdmin\AzureStack\AzureStack.psd1"
DestinationFolder="$(LibrarySourceFolder)\Stack\$(Configuration)" Condition= " '$(NetCore)' == 'false' and '$(Stack)' == 'true' "/>
<Copy SourceFiles="$(LibrarySourceFolder)\StackAdmin\AzureStack\AzureStack.psm1"
DestinationFolder="$(LibrarySourceFolder)\Stack\$(Configuration)" Condition= " '$(NetCore)' == 'false' and '$(Stack)' == 'true' "/>

<Copy SourceFiles="$(LibraryRoot)setup\Setup\RemoveGalleryModules.ps1"
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)"
Expand All @@ -239,16 +231,10 @@

<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
DestinationFolder="$(LibraryRoot)tools\AzureRM" Condition= " '$(NetCore)' == 'false' and '$(Latest)' == 'true' "/>
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psm1"
DestinationFolder="$(LibraryRoot)tools\AzureRM" Condition= " '$(NetCore)' == 'false' and '$(Latest)' == 'true' "/>
<Copy SourceFiles="$(LibrarySourceFolder)\Stack\$(Configuration)\AzureRM.psd1"
DestinationFolder="$(LibrarySourceFolder)\StackAdmin\AzureRM" Condition= " '$(NetCore)' == 'false' and '$(Stack)' == 'true' "/>
<Copy SourceFiles="$(LibrarySourceFolder)\Stack\$(Configuration)\AzureRM.psm1"
DestinationFolder="$(LibrarySourceFolder)\StackAdmin\AzureRM" Condition= " '$(NetCore)' == 'false' and '$(Stack)' == 'true' "/>
<Copy SourceFiles="$(LibrarySourceFolder)\Stack\$(Configuration)\AzureStack.psd1"
DestinationFolder="$(LibrarySourceFolder)\StackAdmin\AzureStack" Condition= " '$(NetCore)' == 'false' and '$(Stack)' == 'true' "/>
<Copy SourceFiles="$(LibrarySourceFolder)\Stack\$(Configuration)\AzureStack.psm1"
DestinationFolder="$(LibrarySourceFolder)\StackAdmin\AzureStack" Condition= " '$(NetCore)' == 'false' and '$(Stack)' == 'true' "/>
<!-- moved copy tasks -->

<CallTarget Targets="BuildSetup" Condition=" '$(SkipHelp)' == 'false' "/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using Newtonsoft.Json;
using System;

namespace Microsoft.WindowsAzure.Commands.Common
namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
{
public class AzurePSDataCollectionProfile
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@
<Compile Include="AuthenticationStore.cs" />
<Compile Include="Authentication\AadAuthenticationException.cs" />
<Compile Include="AzureAccount.cs" />
<Compile Include="AzurePSDataCollectionProfile.cs" />
<Compile Include="AzureRmProfileProvider.cs" />
<Compile Include="AzureSMProfileProvider.cs" />
<Compile Include="ContextSaveMode.cs" />
<Compile Include="DataCollectionController.cs" />
<Compile Include="DiskDataStore.cs" />
<Compile Include="Extensions\AzureAccountExtensions.cs" />
<Compile Include="AzureEnvironmentConstants.cs" />
<Compile Include="Extensions\AzureContextExtensions.cs" />
Expand Down Expand Up @@ -157,6 +160,7 @@
<Compile Include="Settings\UserAgentSettings.cs" />
<Compile Include="Settings\HandlerSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities\FileUtilities.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <summary>
/// A ddata store based on the managed windows file system functions (System.IO)
Expand Down Expand Up @@ -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))
Expand All @@ -212,7 +215,11 @@ public X509Certificate2 GetCertificate(string thumbprint)
/// <param name="cert">The certificate to add</param>
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);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,15 @@
<data name="InvalidDnsName" xml:space="preserve">
<value>"{0}" is an invalid DNS name for {1}</value>
</data>
<data name="InvalidOrEmptyArgumentMessage" xml:space="preserve">
<value>{0} is invalid or empty.</value>
</data>
<data name="NoInternetConnection" xml:space="preserve">
<value>Please connect to internet before executing this cmdlet</value>
</data>
<data name="PathDoesNotExist" xml:space="preserve">
<value>Path {0} doesn't exist.</value>
</data>
<data name="ProfileLockReadDisposed" xml:space="preserve">
<value>Attempted to read from the Azure PowerShell context after it was disposed. Please reload the module and try this operation again.</value>
</data>
Expand Down Expand Up @@ -180,4 +186,7 @@
<data name="SessionNotInitialized" xml:space="preserve">
<value>The Azure PowerShell session has not been properly initialized. Please import the module and try again.</value>
</data>
<data name="x86InProgramFiles" xml:space="preserve">
<value>(x86)</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@
// 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;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Microsoft.WindowsAzure.Commands.Common
namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
{
/// <summary>
/// File utilities using the data store
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -167,7 +164,7 @@ public static void DirectoryCopy(string sourceDirName, string destDirName, bool
/// <param name="pathName">The path to the file that will be created</param>
public static void EnsureDirectoryExists(string pathName)
{
Validate.ValidateStringIsNullOrEmpty(pathName, "Settings directory");
ValidateStringIsNullOrEmpty(pathName, "Settings directory");
string directoryPath = Path.GetDirectoryName(pathName);
if (!DataStore.DirectoryExists(directoryPath))
{
Expand Down Expand Up @@ -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);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.Azure.Commands.Common.Authentication.Factories;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.WindowsAzure.Commands.Common;
using System;
using System.IO;
using System.Diagnostics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@
<Project>{70527617-7598-4aef-b5bd-db9186b8184b}</Project>
<Name>Commands.Common.Authentication.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\Commands.Common\Commands.Common.csproj">
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
<Name>Commands.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions src/Common/Commands.Common/Commands.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,14 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DiskDataStore.cs" />
<Compile Include="DataCollectionController.cs" />
<Compile Include="Serialization\LegacyAzureAccount.cs" />
<Compile Include="Serialization\LegacyAzureEnvironment.cs" />
<Compile Include="Serialization\LegacyAzureSubscription.cs" />
<Compile Include="Serialization\ModelConversionExtensions.cs" />
<Compile Include="Utilities\FileUtilities.cs" />
<Compile Include="Utilities\INetworkHelper.cs" />
<Compile Include="Utilities\JsonUtilities.cs" />
<Compile Include="AzureDataCmdlet.cs" />
<Compile Include="AzurePSCmdlet.cs" />
<Compile Include="AzurePSDataCollectionProfile.cs" />
<Compile Include="AzurePowerShell.cs" />
<Compile Include="Extensions\ConcurrentQueueExtensions.cs" />
<Compile Include="Constants.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/Common/Commands.Common/Extensions/CmdletExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/Common/Commands.Common/MetricHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Commands.Common/Utilities/Validate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Common.Authentication;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
Expand All @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Loading