Skip to content

Commit 5c475fb

Browse files
author
Pooneh
committed
Key Vault Client and WebKey are added to the Key Vault and dependency to the nuget package is removed
1 parent ab6abfe commit 5c475fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2879
-177
lines changed

setup/azurecmdfiles.wxi

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,6 @@
174174
<Component Id="cmp1CF758FE0016953D21E5F77BDBACAD67" Guid="*">
175175
<File Id="filF0F2384641B1265D7C3EE17F535C5AB6" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\KeyVault\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" />
176176
</Component>
177-
<Component Id="cmp364F3DC26F39423F9A6425347B37F531" Guid="*">
178-
<File Id="filE8052090F25525C434ACFB1EA51DC012" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\KeyVault\Microsoft.KeyVault.Client.dll" />
179-
</Component>
180-
<Component Id="cmpB74605FD32BFDC06540E3370F2DFD288" Guid="*">
181-
<File Id="fil24F3CCC97138E8E936DF53D7CFA1AB3D" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\KeyVault\Microsoft.KeyVault.WebKey.dll" />
182-
</Component>
183177
<Component Id="cmp9769FB9AE18A4E4577D1BD7E3403CB34" Guid="*">
184178
<File Id="fil2CEB17E423541A3D671422B358DDE064" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\KeyVault\Microsoft.Threading.Tasks.dll" />
185179
</Component>
@@ -364,12 +358,6 @@
364358
<Component Id="cmpE7396D3C1C29168AEE4870C9146437BD" Guid="*">
365359
<File Id="fil0E08B214ECA57F6568B57B9D0DD2AE45" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Resources\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll" />
366360
</Component>
367-
<Component Id="cmp849F8F09072CD3F5BDB735EA3F01C201" Guid="*">
368-
<File Id="filDAB62233F1E63875A75ACCCC6A9432AD" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Resources\Microsoft.KeyVault.Client.dll" />
369-
</Component>
370-
<Component Id="cmp1B9313BAE4F0C674D5BF23ACDEF01F7E" Guid="*">
371-
<File Id="filD005E159825AE205F602D260E923E5EB" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Resources\Microsoft.KeyVault.WebKey.dll" />
372-
</Component>
373361
<Component Id="cmpEFA6723DE788649C36CFD4875ED618EA" Guid="*">
374362
<File Id="fil78AAA3947F601D3ADDB76B379E3EBF8E" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Resources\Microsoft.Threading.Tasks.dll" />
375363
</Component>
@@ -2148,8 +2136,6 @@
21482136
<ComponentRef Id="cmp8885D62E14E2D7967F6F1C56F44E4821" />
21492137
<ComponentRef Id="cmpF688538124E45386E4034F5FBC575335" />
21502138
<ComponentRef Id="cmp1CF758FE0016953D21E5F77BDBACAD67" />
2151-
<ComponentRef Id="cmp364F3DC26F39423F9A6425347B37F531" />
2152-
<ComponentRef Id="cmpB74605FD32BFDC06540E3370F2DFD288" />
21532139
<ComponentRef Id="cmp9769FB9AE18A4E4577D1BD7E3403CB34" />
21542140
<ComponentRef Id="cmpB9D75E456981F55A2AD9326C06FA5569" />
21552141
<ComponentRef Id="cmp44B0C78318DD9232407385356323964F" />
@@ -2210,8 +2196,6 @@
22102196
<ComponentRef Id="cmpBF4C7868DB8CE8B4B50CAF51B647E2B1" />
22112197
<ComponentRef Id="cmp3F61F18D6C072A4C001EB2E9AC4DA285" />
22122198
<ComponentRef Id="cmpE7396D3C1C29168AEE4870C9146437BD" />
2213-
<ComponentRef Id="cmp849F8F09072CD3F5BDB735EA3F01C201" />
2214-
<ComponentRef Id="cmp1B9313BAE4F0C674D5BF23ACDEF01F7E" />
22152199
<ComponentRef Id="cmpEFA6723DE788649C36CFD4875ED618EA" />
22162200
<ComponentRef Id="cmp460A69220930FF8C24C3EF4152E98389" />
22172201
<ComponentRef Id="cmp7ED34ED999B020C904F2E11980F66271" />

src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@
5555
<SpecificVersion>False</SpecificVersion>
5656
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
5757
</Reference>
58-
<Reference Include="Microsoft.KeyVault.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
59-
<SpecificVersion>False</SpecificVersion>
60-
<HintPath>..\..\..\packages\Microsoft.KeyVault.Client.1.0.0.26\lib\net45\Microsoft.KeyVault.Client.dll</HintPath>
61-
</Reference>
62-
<Reference Include="Microsoft.KeyVault.WebKey, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
63-
<SpecificVersion>False</SpecificVersion>
64-
<HintPath>..\..\..\packages\Microsoft.KeyVault.WebKey.1.0.0.18\lib\net45\Microsoft.KeyVault.WebKey.dll</HintPath>
65-
</Reference>
6658
<Reference Include="Microsoft.Threading.Tasks">
6759
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
6860
</Reference>

src/ResourceManager/KeyVault/Commands.KeyVault.Test/Models/UtilitiesTests.cs

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

15-
using System;
15+
using Microsoft.Azure.Commands.KeyVault.Client;
1616
using Microsoft.Azure.Commands.KeyVault.Models;
17-
using Microsoft.KeyVault.WebKey;
17+
using Microsoft.Azure.Commands.KeyVault.WebKey;
1818
using Microsoft.WindowsAzure.Commands.ScenarioTest;
19+
using System;
1920
using System.IO;
2021
using System.Linq;
2122
using System.Security.Cryptography;
22-
using Xunit;
2323
using System.Security.Cryptography.X509Certificates;
24+
using Xunit;
2425

2526
namespace Microsoft.Azure.Commands.KeyVault.Test.Models
2627
{
@@ -31,8 +32,8 @@ public class UtilitiesTests
3132
public void ConvertStringAndSecureString()
3233
{
3334
var origStr = "this is test string";
34-
var secureString = origStr.ToSecureString();
35-
var convStr = secureString.ToStringExt();
35+
var secureString = origStr.ConvertToSecureString();
36+
var convStr = secureString.ConvertToString();
3637

3738
Assert.Equal( origStr, convStr );
3839
}
@@ -62,7 +63,7 @@ public void GetWebKeyFromCertificate()
6263
File.WriteAllBytes(tempPath, Resource.pfxCert);
6364

6465
IWebKeyConverter converters = WebKeyConverterFactory.CreateConverterChain();
65-
var webKey = converters.ConvertKeyFromFile(new FileInfo(tempPath), password.ToSecureString());
66+
var webKey = converters.ConvertKeyFromFile(new FileInfo(tempPath), password.ConvertToSecureString());
6667

6768
Assert.True(webKey.HasPrivateKey());
6869
Assert.True(webKey.IsValid());

src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919
using System;
2020
using System.Management.Automation;
2121
using Xunit;
22+
using WebKey = Microsoft.Azure.Commands.KeyVault.WebKey;
2223

2324
namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests
2425
{
2526
public class RemoveKeyVaultKeyTests : KeyVaultUnitTestBase
2627
{
2728
private RemoveAzureKeyVaultKey cmdlet;
2829
private KeyAttributes keyAttributes;
29-
private Microsoft.KeyVault.WebKey.JsonWebKey webKey;
30+
private WebKey.JsonWebKey webKey;
3031
private KeyBundle keyBundle;
3132

3233
public RemoveKeyVaultKeyTests()
@@ -41,7 +42,7 @@ public RemoveKeyVaultKeyTests()
4142
};
4243

4344
keyAttributes = new KeyAttributes(true, DateTime.Now, DateTime.Now, "HSM", new string[]{"All"});
44-
webKey = new Microsoft.KeyVault.WebKey.JsonWebKey();
45+
webKey = new WebKey.JsonWebKey();
4546
keyBundle = new KeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName };
4647
}
4748

src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultSecretTests.cs

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

15+
using Microsoft.Azure.Commands.KeyVault.Client;
1516
using Microsoft.Azure.Commands.KeyVault.Cmdlets;
16-
using Microsoft.Azure.Commands.KeyVault.Models;
17+
using Cmdlet = Microsoft.Azure.Commands.KeyVault.Models;
1718
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1819
using Moq;
1920
using System;
@@ -43,8 +44,8 @@ public RemoveKeyVaultSecretTests()
4344
[Trait(Category.AcceptanceType, Category.CheckIn)]
4445
public void CanRemoveSecretWithPassThruTest()
4546
{
46-
SecureString secureSecretValue = SecretValue.ToSecureString();
47-
Secret expected = new Secret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue };
47+
SecureString secureSecretValue = SecretValue.ConvertToSecureString();
48+
Cmdlet.Secret expected = new Cmdlet.Secret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue };
4849
keyVaultClientMock.Setup(kv => kv.DeleteSecret(VaultName, SecretName)).Returns(expected).Verifiable();
4950

5051
// Mock the should process to return true
@@ -72,8 +73,8 @@ public void CanRemoveSecretWithPassThruTest()
7273
[Trait(Category.AcceptanceType, Category.CheckIn)]
7374
public void CanRemoveSecretWithNoPassThruTest()
7475
{
75-
SecureString secureSecretValue = SecretValue.ToSecureString();
76-
Secret expected = new Secret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue };
76+
SecureString secureSecretValue = SecretValue.ConvertToSecureString();
77+
Cmdlet.Secret expected = new Cmdlet.Secret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue };
7778
keyVaultClientMock.Setup(kv => kv.DeleteSecret(VaultName, SecretName)).Returns(expected).Verifiable();
7879

7980
// Mock the should process to return true
@@ -92,7 +93,7 @@ public void CanRemoveSecretWithNoPassThruTest()
9293
[Trait(Category.AcceptanceType, Category.CheckIn)]
9394
public void CannotRemoveSecretWithoutShouldProcessOrForceConfirmationTest()
9495
{
95-
Secret expected = null;
96+
Cmdlet.Secret expected = null;
9697

9798
cmdlet.Name = SecretName;
9899
cmdlet.PassThru = true;

src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,23 @@
1919
using System;
2020
using System.Management.Automation;
2121
using Xunit;
22+
using WebKey = Microsoft.Azure.Commands.KeyVault.WebKey;
2223

2324
namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests
2425
{
2526
public class SetKeyVaultKeyTests : KeyVaultUnitTestBase
2627
{
2728
private SetAzureKeyVaultKey cmdlet;
2829
private KeyAttributes keyAttributes;
29-
private Microsoft.KeyVault.WebKey.JsonWebKey webKey;
30+
private WebKey.JsonWebKey webKey;
3031
private KeyBundle keyBundle;
3132

3233
public SetKeyVaultKeyTests()
3334
{
3435
base.SetupTest();
3536

3637
keyAttributes = new KeyAttributes(true, DateTime.Now, DateTime.Now, null, null);
37-
webKey = new Microsoft.KeyVault.WebKey.JsonWebKey();
38+
webKey = new WebKey.JsonWebKey();
3839
keyBundle = new KeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName, Version = KeyVersion };
3940

4041
cmdlet = new SetAzureKeyVaultKey()

src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs

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

15+
using Microsoft.Azure.Commands.KeyVault.Client;
1516
using Microsoft.Azure.Commands.KeyVault.Cmdlets;
16-
using Microsoft.Azure.Commands.KeyVault.Models;
17+
using Cmdlet = Microsoft.Azure.Commands.KeyVault.Models;
1718
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1819
using Moq;
1920
using System;
@@ -43,8 +44,8 @@ public SetKeyVaultSecretTests()
4344
[Trait(Category.AcceptanceType, Category.CheckIn)]
4445
public void CanSetSecretTest()
4546
{
46-
SecureString secureSecretValue = SecretValue.ToSecureString();
47-
Secret expected = new Secret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue, Version = SecretVersion };
47+
SecureString secureSecretValue = SecretValue.ConvertToSecureString();
48+
Cmdlet.Secret expected = new Cmdlet.Secret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue, Version = SecretVersion };
4849
keyVaultClientMock.Setup(kv => kv.SetSecret(VaultName, SecretName, secureSecretValue)).Returns(expected).Verifiable();
4950

5051
cmdlet.Name = SecretName;
@@ -60,7 +61,7 @@ public void CanSetSecretTest()
6061
[Trait(Category.AcceptanceType, Category.CheckIn)]
6162
public void ErrorSetSecretTest()
6263
{
63-
SecureString secureSecretValue = SecretValue.ToSecureString();
64+
SecureString secureSecretValue = SecretValue.ConvertToSecureString();
6465
keyVaultClientMock.Setup(kv => kv.SetSecret(VaultName, SecretName, secureSecretValue))
6566
.Throws(new Exception("exception")).Verifiable();
6667

src/ResourceManager/KeyVault/Commands.KeyVault.Test/packages.config

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
77
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
88
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.11.10918.1222" targetFramework="net45" />
9-
<package id="Microsoft.KeyVault.Client" version="1.0.0.26" targetFramework="net45" />
10-
<package id="Microsoft.KeyVault.WebKey" version="1.0.0.18" targetFramework="net45" />
119
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
1210
<package id="Microsoft.WindowsAzure.Common" version="1.4.0" targetFramework="net45" />
1311
<package id="Microsoft.WindowsAzure.Common.Dependencies" version="1.1.0" targetFramework="net45" />

0 commit comments

Comments
 (0)