title | description | author | tags | ms.assetid | ms.topic | ms.date | ms.author | ms.custom |
---|---|---|---|---|---|---|---|---|
PowerShell: Assign a custom domain |
Learn how to use Azure PowerShell to automate deployment and management of App Service. This sample shows how to assign a custom domain to an app. |
msangapu-msft |
azure-service-management |
356f5af9-f62e-411c-8b24-deba05214103 |
sample |
12/06/2022 |
msangapu |
mvc, devx-track-azurepowershell |
This sample script creates a web app in App Service with its related resources, and then maps www.<yourdomain>
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, you need to have access to your domain registrar's DNS configuration page.
[!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. |
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.