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 |
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.
[!INCLUDE updated-for-az]
[!code-azurepowershell-interactivemain]
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
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. |
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.