Forum Discussion
Petri-X
Nov 28, 2024Bronze Contributor
Deploying Microsoft.Web/sites via PowerShell..?
Hi, I do have a ARM template which plays hard game with me, or more likely our security hardenings might make my day enough hard. But I should deploy following resources: Microsoft.Web/ServerFarm ...
Kidd_Ip
Nov 29, 2024MVP
Consider this:
Deploying an App Service Plan (Microsoft.Web/ServerFarm)
1. Install the Azure PowerShell Module (if not already installed):
Install-Module -Name Az -AllowClobber -Scope CurrentUser
2. Connect to your Azure account:
Connect-AzAccount
3. Create an App Service Plan:
$resourceGroupName = "YourResourceGroupName" $location = "YourLocation" $appServicePlanName = "YourAppServicePlanName" $sku = "S1" # Example SKU, adjust as needed New-AzAppServicePlan -ResourceGroupName $resourceGroupName -Location $location -Name $appServicePlanName -Tier $sku
Deploying a Web App (Microsoft.Web/sites)
- Create a Web App:
$webAppName = "YourWebAppName" $appServicePlanName = "YourAppServicePlanName" $resourceGroupName = "YourResourceGroupName" $location = "YourLocation" New-AzWebApp -ResourceGroupName $resourceGroupName -Location $location -AppServicePlan $appServicePlanName -Name $webAppName
Debugging Tips
- Verbose Output: Use the -Verbose flag with your PowerShell commands to get more detailed output, which can help in debugging.
New-AzAppServicePlan -ResourceGroupName $resourceGroupName -Location $location -Name $appServicePlanName -Tier $sku -Verbose
- Check Azure Activity Log: The Azure Activity Log can provide insights into what might be going wrong during the deployment.
- Review Network and Security Settings: Ensure that your network and security settings (like NSGs, firewalls, etc.) are not blocking the deployment.