Skip to content

Commit b29d305

Browse files
authored
Revert AzureKeyVaultV1/2 to m213 state (#17505)
1 parent b41bd11 commit b29d305

File tree

11 files changed

+242
-1145
lines changed

11 files changed

+242
-1145
lines changed

Tasks/AzureKeyVaultV1/README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Ensure the Azure endpoint has at least Get and List permissions for Secrets on t
5151

5252
For example, if there is a secret name: connectionString, a task variable `$(connectionString)` is created with the latest fetched value of the respective secret from Azure key vault. And this secret variable would be available to be consumed in subsequent tasks.
5353

54-
Certificates are also fetched from the vault as secrets. In this case, the task variable would contain the content of the PFX in base64 string format. To convert the string into a PFX file from the task variable, the following sample PowerShell code can be used (after passing the certificate variable as a parameter to the script):
54+
If it is a certificate (example: a PFX file) that is fetched from the vault, then the task variable would contain the content of the PFX in string format. To retrieve the PFX file from the task variable, the following sample PowerShell code can be used (after passing the certificate variable as a parameter to the script):
5555

5656
```powershell
5757
# Task parameters: $(PfxSecret)
@@ -61,16 +61,7 @@ Certificates are also fetched from the vault as secrets. In this case, the task
6161
$certCollection.Import($kvSecretBytes, $null, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
6262
```
6363

64-
Here's an example of how you can import the certificate into a local store:
65-
66-
```powershell
67-
$CertStore = New-Object System.Security.Cryptography.X509Certificates.X509Store("My","LocalMachine")
68-
$CertStore.Open("ReadWrite")
69-
$CertStore.AddRange($certCollection)
70-
$CertStore.Close()
71-
```
72-
73-
Alternatively, if the certificate file needs to be stored as a PFX file on the hard disk then it is good practice to encrypt it with a password:
64+
If the certificate file needs to be stored on the hard disk then it is good practice to encrypt it with a password:
7465

7566
```powershell
7667
# Get the file created

Tasks/AzureKeyVaultV1/Tests/L0.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ describe('Azure Key Vault', function () {
3131

3232
assert(tr.stdout.indexOf("getSecretValue is called for secret4") < 0, "getSecretValue should not be called for secret4");
3333

34-
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret1;isOutput=false;issecret=true;]secret1-value") > 0, "##vso[task.setvariable variable=secret1;isOutput=false;issecret=true;]secret1-value");
35-
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret2;isOutput=false;issecret=true;]secret2-value") > 0, "##vso[task.setvariable variable=secret2;isOutput=false;issecret=true;]secret2-value");
36-
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret3;isOutput=false;issecret=true;]secret3-value") > 0, "##vso[task.setvariable variable=secret3;isOutput=false;issecret=true;]secret3-value");
34+
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret1;issecret=true;]secret1-value") > 0, "##vso[task.setvariable variable=secret1;issecret=true;]secret1-value");
35+
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret2;issecret=true;]secret2-value") > 0, "##vso[task.setvariable variable=secret2;issecret=true;]secret2-value");
36+
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret3;issecret=true;]secret3-value") > 0, "##vso[task.setvariable variable=secret3;issecret=true;]secret3-value");
3737

38-
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret4;isOutput=false;issecret=true;]secret4-value") < 0, "secret4 value should not be set");
38+
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret4;issecret=true;]secret4-value") < 0, "secret4 value should not be set");
3939

4040
done();
4141
}
@@ -62,12 +62,12 @@ describe('Azure Key Vault', function () {
6262
assert(tr.stdout.indexOf("getSecretValue is called for secret2") > 0, "getSecretValue is called for secret2");
6363
assert(tr.stdout.indexOf("getSecretValue is called for secret3/versionIdentifierGuid") > 0, "getSecretValue is called for secret3/versionIdentifierGuid");
6464

65-
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret1;isOutput=false;issecret=true;]secret1-value") > 0, "##vso[task.setvariable variable=secret1;issecret=true;]secret1-value");
66-
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret2;isOutput=false;issecret=true;]secret2-value") > 0, "##vso[task.setvariable variable=secret2;issecret=true;]secret2-value");
67-
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret3;isOutput=false;issecret=true;]secret3/versionIdentifierGuid-value") > 0, "##vso[task.setvariable variable=secret3;issecret=true;]secret3/versionIdentifierGuid-value");
68-
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret3/versionIdentifierGuid;isOutput=false;issecret=true;]secret3/versionIdentifierGuid-value") > 0, "##vso[task.setvariable variable=secret3/versionIdentifierGuid;issecret=true;]secret3/versionIdentifierGuid-value");
65+
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret1;issecret=true;]secret1-value") > 0, "##vso[task.setvariable variable=secret1;issecret=true;]secret1-value");
66+
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret2;issecret=true;]secret2-value") > 0, "##vso[task.setvariable variable=secret2;issecret=true;]secret2-value");
67+
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret3;issecret=true;]secret3/versionIdentifierGuid-value") > 0, "##vso[task.setvariable variable=secret3;issecret=true;]secret3/versionIdentifierGuid-value");
68+
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret3/versionIdentifierGuid;issecret=true;]secret3/versionIdentifierGuid-value") > 0, "##vso[task.setvariable variable=secret3/versionIdentifierGuid;issecret=true;]secret3/versionIdentifierGuid-value");
6969

70-
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret4;isOutput=false;issecret=true;]secret4-value") < 0, "secret4 value should not be set");
70+
assert(tr.stdout.indexOf("##vso[task.setvariable variable=secret4;issecret=true;]secret4-value") < 0, "secret4 value should not be set");
7171

7272
done();
7373
}

0 commit comments

Comments
 (0)