website creation fails with serverfarm not found Azure Powershell

3.5k views Asked by At

I am struggling to get the Drupal Webapp created using powershell with a GalleryTemplate Json file. It creates Serverfarm, Database servers but fails for website creation. I am not able to figure out how to move ahead as website creation need to use the created hostingplan serverfarm.It would be great help to get a expertise help on the below. Thanks in advance.

GalleryTemplateIdentity :: Acquiacom.AcquiaDrupal7SQL.0.3.16-preview

PS C:\scripts> New-AzureResourceGroup -Name azurepowershellush -TemplateFile F:\DeployerScript\Acquiacom.AcquiaDrupal7SQL.0.3.16-preview.json -StorageAccountName pilot -Location "East US"

Prompt User Inputs

WARNING: The Switch-AzureMode cmdlet is deprecated and will be removed in a future release.
cmdlet New-AzureResourceGroup at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
siteName: azureappush
hostingPlanName: DefaultServerFarm
serverFarmResourceGroup: DefaultServerFarm
siteLocation: East US
serverName: azureappush
serverLocation: East US
administratorLogin: adminXprt_1
databaseName: adminXprt_1
webDeploy_DatabaseUsername: adminXprt_1
webDeploy_DatabasePassword: Sample_1987

Output

New-AzureResourceGroup : 10:11:41 AM - Resource Microsoft.Web/Sites 'azureappush' failed with message 'Cannot find ServerFarm with 
name DefaultServerFarm.'

ResourceGroupName : azurepowershellush
Location          : eastus
Resources         : {azureappush, adminXprt_1, azurepowerush, azurepowerush1...}
ResourcesTable    : 
                    Name               Type                             Location
                    =================  ===============================  ========
                    azureappush        Microsoft.Sql/servers            eastus  
                    adminXprt_1        Microsoft.Sql/servers/databases  eastus  
                    azurepowerush      Microsoft.Sql/servers            eastus  
                    azurepowerush1     Microsoft.Sql/servers            eastus  
                    adminxprt_1        Microsoft.Sql/servers/databases  eastus  
                    adminxprt_1        Microsoft.Sql/servers/databases  eastus  
                    Default1           Microsoft.Web/serverFarms        eastus  
                    DefaultServerFarm  Microsoft.Web/serverFarms        eastus  

ProvisioningState : Succeeded
Permissions       : {Microsoft.Azure.Commands.Resources.Models.Authorization.PSPermission}

Thanks & Regards,

Harish

1

There are 1 answers

3
theadriangreen On BEST ANSWER

It looks like the web app is unable to find the server farm (AKA app service plan) since it's in a different resource group. To fix this, try creating the ServerFarm and web app in the same resource group.

i.e. use this command:

PS C:\scripts> New-AzureResourceGroup -Name "azurepowershellush" -TemplateFile F:\DeployerScript\Acquiacom.AcquiaDrupal7SQL.0.3.16-preview.json -StorageAccountName pilot -Location "East US" -siteName "azureappush"
-hostingPlanName "DefaultServerFarm" -serverFarmResourceGroup "azurepowershellush" -siteLocation "East US" -serverName "azureappush" -serverLocation "East US" -administratorLogin "adminXprt_1" -databaseName "adminXprt_1" -webDeploy_DatabaseUsername "adminXprt_1" -webDeploy_DatabasePassword "Sample_1987"

Note that -Name and -serverFarmResourceGroup are both "azurepowershellush".