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
Microsoft.Web/sites
Which at the moment are failing. And debug logs shows not that much help.
So I thought can I deploy those somehow on from the PowerShell and perhaps debug that in better way? I was not able to find more than: New-AzWebApp | Microsoft Learn but that does not do the same.
Does any body have a clue how to create such a resources without ARM templates?
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.
- Create a Web App: