Certificate renewal can be a tedious job, especially when deploying multiple IIS Web applications. The reason for this is because the IIS Web App Manage task in the release pipeline needs the SSL certificate thumbprint to know which certificate to use in the HTTPS binding. Whenever the certificate is renewed, the old thumbprint needs to be replaced by a new one for each deployment/release pipeline.
In this post we’ll see how we can use a Variable group to define the SSL certificate thumbprint once and use it during the deployment step.
Create a variable group
- Open the Library tab on the left to see a list of existing variable groups for your project.
- Choose + Variable group to start adding a new variable group.
- Enter a name and description for the group. Give it the name Thumbprints for example.
- Enter the name for the certificate thumbprint variable (f.e. MyCertificateThumbprint) and enter the certificate thumbprint in the value field. If you want to encrypt and securely store the value, choose the “lock” icon at the end of the row.
- Choose Save.
Link the variable group
- Open the Variables tab of the release pipeline.
- Choose Variable groups and click the Link variable group button.
- Select the new variable group Thumbprints and click the Link button.
To link the variable group from a YAML file:
For more information about variable groups, see the Microsoft documentation.
Modify the bindings
- Edit the release pipeline (when you have more than one already, you’ll have to edit them one by one).
- Select the IIS Web App Manage task (or the Stage depending on where you can configure the bindings).
- Configure the binding for HTTPS (port 443).
- Paste $(MyCertificateThumbprint) in the SSL certificate thumbprint field.
- Press OK to close the binding dialog.
- Save the release pipeline.
Changing the thumbprint
Whenever the certificate expires, make sure all your deployment targets have the updated certificate. After that, change the thumbprint for the $(MyCertificateThumbprint) variable once in the variable group and it will be automatically applied to every next release.