Skip to content

Commit b9f22dc

Browse files
committed
Merge pull request Azure#44 from huangpf/crp2
Crp2
2 parents 83714a0 + 8bbfdbe commit b9f22dc

16 files changed

+105
-214
lines changed

src/AzurePowershell.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.NetworkResourcePro
179179
EndProject
180180
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Compute", "ResourceManager\Compute\Commands.Compute\Commands.Compute.csproj", "{52643BD5-6378-49BD-9F6E-DAC9DD8A867B}"
181181
ProjectSection(ProjectDependencies) = postProject
182+
{E1F5201D-6067-430E-B303-4E367652991B} = {E1F5201D-6067-430E-B303-4E367652991B}
182183
{98CFD96B-A6BC-4F15-AE2C-603FC2B58981} = {98CFD96B-A6BC-4F15-AE2C-603FC2B58981}
183184
{E1CA72BA-8374-45F6-904D-FD34ECDF5B6F} = {E1CA72BA-8374-45F6-904D-FD34ECDF5B6F}
184185
EndProjectSection

src/Common/Commands.Common/Commands.Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
<ItemGroup>
145145
<Compile Include="AzurePowerShell.cs" />
146146
<Compile Include="Constants.cs" />
147+
<Compile Include="SecureStringExtensions.cs" />
147148
<Compile Include="ConversionUtilities.cs" />
148149
<Compile Include="DebugStreamTraceListener.cs" />
149150
<Compile Include="GeneralUtilities.cs" />

src/Common/Commands.Common/Properties/Resources.Designer.cs

Lines changed: 1 addition & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Common/Commands.Common/Properties/Resources.resx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,10 +1358,4 @@ use and privacy statement at &lt;url&gt; and (c) agree to sharing my contact inf
13581358
<data name="AzureProfileMustNotBeNull" xml:space="preserve">
13591359
<value>Selected profile must not be null.</value>
13601360
</data>
1361-
<data name="InvalidTagFormat" xml:space="preserve">
1362-
<value>Invalid tag format. Expect @{Name = "tagName"} or @{Name = "tagName"; Value = "tagValue"}</value>
1363-
</data>
1364-
<data name="InvalidTagFormatNotUniqueName" xml:space="preserve">
1365-
<value>Invalid tag format. Ensure that each tag has a unique name. Example: @{Name = "tagName1"; Value = "tagValue1"}, @{Name = "tagName2"; Value = "tagValue2"}</value>
1366-
</data>
13671361
</root>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Runtime.InteropServices;
17+
using System.Security;
18+
19+
namespace Microsoft.WindowsAzure.Commands.Common
20+
{
21+
/// <summary>
22+
/// Extends SecureString and string to convert from one to the other
23+
/// </summary>
24+
public static class SecureStringExtensions
25+
{
26+
27+
/// <summary>
28+
/// Converts a string into a secure string.
29+
/// </summary>
30+
/// <param name="value">the string to be converted.</param>
31+
/// <returns>The secure string converted from the input string </returns>
32+
public static SecureString ConvertToSecureString(this string value)
33+
{
34+
if (value == null)
35+
{
36+
throw new ArgumentNullException("value");
37+
}
38+
39+
unsafe
40+
{
41+
fixed (char* chars = value)
42+
{
43+
SecureString secureString = new SecureString(chars, value.Length);
44+
secureString.MakeReadOnly();
45+
return secureString;
46+
}
47+
}
48+
}
49+
50+
/// <summary>
51+
/// Converts the secure string to a string.
52+
/// </summary>
53+
/// <param name="secureString">the secure string to be converted.</param>
54+
/// <returns>The string converted from a secure string </returns>
55+
public static string ConvertToString(this SecureString secureString)
56+
{
57+
if (secureString == null)
58+
{
59+
throw new ArgumentNullException("secureString");
60+
}
61+
62+
IntPtr stringPointer = IntPtr.Zero;
63+
try
64+
{
65+
stringPointer = Marshal.SecureStringToBSTR(secureString);
66+
return Marshal.PtrToStringBSTR(stringPointer);
67+
}
68+
finally
69+
{
70+
Marshal.ZeroFreeBSTR(stringPointer);
71+
}
72+
}
73+
}
74+
}

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@
116116
</Reference>
117117
<Reference Include="System" />
118118
<Reference Include="System.Core" />
119-
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
120-
<SpecificVersion>False</SpecificVersion>
121-
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll</HintPath>
122-
</Reference>
119+
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
123120
<Reference Include="System.Net" />
124121
<Reference Include="System.Net.Http" />
125122
<Reference Include="System.Net.Http.Extensions, Version=2.2.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132
<Compile Include="AvailabilitySets\NewAzureAvailabilitySetCommand.cs" />
133133
<Compile Include="AvailabilitySets\AvailabilitySetBaseCmdlet.cs" />
134134
<Compile Include="Common\ExtensionSettingBuilder.cs" />
135-
<Compile Include="Common\TagsConversionHelper.cs" />
136135
<Compile Include="Common\ComputeClient.cs" />
137136
<Compile Include="Extension\SetAzureVMExtensionCommand.cs" />
138137
<Compile Include="Extension\RemoveAzureVMExtensionCommand.cs" />
@@ -141,7 +140,6 @@
141140
<Compile Include="Models\PSAvailabilitySet.cs" />
142141
<Compile Include="Models\PSVirtualMachineInstanceView.cs" />
143142
<Compile Include="StorageAccount\StorageManagementClient.cs" />
144-
<Compile Include="Common\SecureStringExtension.cs" />
145143
<Compile Include="Models\SourceImageReferenceExtension.cs" />
146144
<Compile Include="StorageAccount\GetAzureStorageAccount.cs" />
147145
<Compile Include="StorageAccount\GetAzureStorageAccountKey.cs" />
@@ -192,6 +190,10 @@
192190
<Project>{c60342b1-47d3-4a0e-8081-9b97ce60b7af}</Project>
193191
<Name>Commands.Profile</Name>
194192
</ProjectReference>
193+
<ProjectReference Include="..\..\Resources\Commands.Resources\Commands.Resources.csproj">
194+
<Project>{e1f5201d-6067-430e-b303-4e367652991b}</Project>
195+
<Name>Commands.Resources</Name>
196+
</ProjectReference>
195197
</ItemGroup>
196198
<ItemGroup>
197199
<None Include="Microsoft.Azure.Commands.Compute.dll-Help.psd1">

src/ResourceManager/Compute/Commands.Compute/Common/SecureStringExtension.cs

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/ResourceManager/Compute/Commands.Compute/Common/TagsConversionHelper.cs

Lines changed: 0 additions & 101 deletions
This file was deleted.

src/ResourceManager/Compute/Commands.Compute/Extension/RemoveAzureVMExtensionCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.Compute.Common;
16-
using Microsoft.Azure.Commands.Compute.Properties;
1716
using Microsoft.Azure.Management.Compute;
17+
using Microsoft.Azure.Management.Compute.Models;
1818
using System.Management.Automation;
1919

2020
namespace Microsoft.Azure.Commands.Compute
2121
{
2222
[Cmdlet(VerbsCommon.Remove, ProfileNouns.VirtualMachineExtension)]
23-
[OutputType(typeof(object))]
23+
[OutputType(typeof(ComputeLongRunningOperationResponse))]
2424
public class RemoveAzureVMExtensionCommand : VirtualMachineExtensionBaseCmdlet
2525
{
2626
[Parameter(HelpMessage = "To force the removal.")]
@@ -32,7 +32,7 @@ public override void ExecuteCmdlet()
3232
base.ExecuteCmdlet();
3333

3434
if (this.Force.IsPresent
35-
|| this.ShouldContinue(Resources.VirtualMachineExtensionRemovalConfirmation, Resources.VirtualMachineExtensionRemovalCaption))
35+
|| this.ShouldContinue(Properties.Resources.VirtualMachineExtensionRemovalConfirmation, Properties.Resources.VirtualMachineExtensionRemovalCaption))
3636
{
3737
var op = this.VirtualMachineExtensionClient.Delete(this.ResourceGroupName, this.VMName, this.Name);
3838
WriteObject(op);

src/ResourceManager/Compute/Commands.Compute/Extension/SetAzureVMExtensionCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.Compute.Common;
16-
using Microsoft.Azure.Commands.Compute.Models;
1716
using Microsoft.Azure.Management.Compute;
1817
using Microsoft.Azure.Management.Compute.Models;
1918
using System.Collections;
@@ -25,7 +24,7 @@ namespace Microsoft.Azure.Commands.Compute
2524
VerbsCommon.Set,
2625
ProfileNouns.VirtualMachineExtension,
2726
DefaultParameterSetName = SettingsParamSet)]
28-
[OutputType(typeof(object))]
27+
[OutputType(typeof(ComputeLongRunningOperationResponse))]
2928
public class SetAzureVMExtensionCommand : VirtualMachineExtensionBaseCmdlet
3029
{
3130
protected const string SettingStringParamSet = "SettingString";

src/ResourceManager/Compute/Commands.Compute/StorageAccount/RemoveAzureStorageAccount.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.Azure.Management.Storage;
16+
using Microsoft.Azure.Management.Storage.Models;
17+
using System.Management.Automation;
18+
1519
namespace Microsoft.Azure.Commands.Compute
1620
{
17-
using System.Management.Automation;
18-
using Azure.Management.Storage;
19-
using Azure.Management.Storage.Models;
20-
2121
/// <summary>
2222
/// Lists all storage services underneath the subscription.
2323
/// </summary>

0 commit comments

Comments
 (0)