Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 2.71 KB

powershell-configure-ssl-certificate.md

File metadata and controls

54 lines (37 loc) · 2.71 KB
title description author tags ms.assetid ms.topic ms.date ms.custom
PowerShell: Upload and bind TLS/SSL
Learn how to use Azure PowerShell to automate deployment and management of App Service. This sample shows how to bind a custom TLS/SSL certificate to an app.
msangapu-msft
azure-service-management
23e83b74-614a-49a0-bc08-7542120eeec5
sample
12/06/2022
mvc, devx-track-azurepowershell

Bind a custom TLS/SSL certificate to a web app using PowerShell

This sample script creates a web app in App Service with its related resources, then binds the TLS/SSL certificate of a custom domain name to it.

If needed, install the Azure PowerShell using the instruction found in the Azure PowerShell guide, and then run Connect-AzAccount to create a connection with Azure. Also, ensure that:

  • A connection with Azure has been created using the az login command.
  • You have access to your domain registrar's DNS configuration page.
  • You have a valid .PFX file and its password for the TLS/SSL certificate you want to upload and bind.

Sample script

[!INCLUDE updated-for-az]

[!code-azurepowershell-interactivemain]

Clean up deployment

After the script sample has been run, the following command can be used to remove the resource group, web app, and all related resources.

Remove-AzResourceGroup -Name myResourceGroup -Force

Script explanation

This script uses the following commands. Each command in the table links to command specific documentation.

Command Notes
New-AzResourceGroup Creates a resource group in which all resources are stored.
New-AzAppServicePlan Creates an App Service plan.
New-AzWebApp Creates a web app.
Set-AzAppServicePlan Modifies an App Service plan to change its pricing tier.
Set-AzWebApp Modifies a web app's configuration.
New-AzWebAppSSLBinding Creates a TLS/SSL certificate binding for a web app.

Next steps

For more information on the Azure PowerShell module, see Azure PowerShell documentation.

Additional Azure Powershell samples for Azure App Service Web Apps can be found in the Azure PowerShell samples.