Skip to content

Commit 173e699

Browse files
authored
(GH-54) Add example for pulling certificate from azure key vault (#81)
Closes #54
1 parent b6de9fd commit 173e699

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
1. [Description](#description)
1313
1. [Setup](#setup)
1414
1. [How it works](#how-it-works)
15+
* [Puppet Function](#puppet-function)
16+
* [Hiera Backend](#hiera-backend)
1517
1. [How it's secure by default](#how-its-secure-by-default)
1618
1. [Usage](#usage)
1719
* [Embedding a secret in a file](#embedding-a-secret-in-a-file)
@@ -33,7 +35,9 @@ The module requires the following:
3335
* Puppet Server running on a machine with Managed Service Identity ( MSI ) and assigned the appropriate permissions
3436
to pull secrets from the vault. To learn more or get help with this please visit https://docs.microsoft.com/en-us/azure/active-directory/managed-service-identity/tutorial-windows-vm-access-nonaad
3537

36-
## How the function works
38+
## How it works
39+
40+
### Puppet Function
3741

3842
This module contains a Puppet 4 function that allows you to securely retrieve secrets from Azure Key Vault. In order to get started simply call the function in your manifests passing in the required parameters:
3943

@@ -53,7 +57,7 @@ In the above example the api_versions hash is important. It is pinning both of
5357
* Instance Metadata Service Versions ( https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service )
5458
* Vault Versions ( TBD )
5559

56-
## How the hiera backend works
60+
### Hiera Backend
5761

5862
This module contains a Hiera 5 backend that allows you to securely retrieve secrets from Azure key vault and use them in hiera.
5963

@@ -233,6 +237,32 @@ $admin_password_secret = azure_key_vault::secret('production-vault', 'admin-pass
233237

234238
**NOTE: Retrieving a specific version of a secret is currently not available via the hiera backend**
235239

240+
### Retrieving a certificate
241+
242+
Azure Key Vault stores certificates "under-the-covers" as secrets. This means you retrieving certificates can be done using the same `azure_key_vault::secret`
243+
function. One thing to keep in mind is that the certificate will be based64 encoded and will need to be decoded before usage to have a valid certificate file.
244+
245+
```puppet
246+
$certificate_secret = azure_key_vault::secret('production-vault', "webapp-certificate", {
247+
metadata_api_version => '2018-04-02',
248+
vault_api_version => '2016-10-01',
249+
})
250+
251+
file { "C:/tmp/webapp-certificate.pfx" :
252+
content => base64('decode', "${certificate_secret.unwrap}"),
253+
ensure => file,
254+
}
255+
256+
sslcertificate { "Install-WebApp-Certificate" :
257+
name => "${filename}",
258+
location => 'C:\tmp',
259+
root_store => 'LocalMachine',
260+
thumbprint => "${certificate_thumbprint}"
261+
}
262+
```
263+
264+
**NOTE: Retrieving a specific version of a secret is currently not available via the hiera backend**
265+
236266
## Reference
237267

238268
See [REFERENCE.md](https://github.com/tragiccode/tragiccode-azure_key_vault/blob/master/REFERENCE.md)

0 commit comments

Comments
 (0)