title: Azure Server Farm Not Found
body: <p>I am trying to create an azure website via a powershell script. The hosting plan has already been create, I simply wish to add a new website to it.</p>
  
  <p>The script I'm using is this:</p>
  
  <pre><code>Switch-AzureMode AzureResourceManager
  
  $targetServicePlan = Get-AzureResource -Name my-serviceplan -OutputObjectFormat New
  
  New-AzureResource -Name MyTestSite -Location "West Europe" `
      -ResourceGroupName Default-Web-WestEurope `
      -ResourceType 'Microsoft.Web/sites' `
      -PropertyObject @{"name" = "MyTestSite"; "ServerFarmId" = $targetServicePlan.ResourceId } `
      -OutputObjectFormat New
  </code></pre>
  
  <p>The server farm ($targetServicePlan) has a resource id, so I'm assuming that it exists (there is also a hosting plan in the azure portal with this name). Yet when I try to create the website I get the error: "Server farm with name my-serviceplan not found."</p>
  
  <p>The full error is:</p>
  
  <pre><code>New-AzureResource : {"Code":"NotFound","Message":"Server farm with name my-serviceplan not found.","Target":null,"Details":[{"Message":"Server farm with name
  my-serviceplan not found."},{"Code":"NotFound"},{"ErrorEntity":{"Code":"NotFound","Message":"Server farm with name my-serviceplan not
  found.","ExtendedCode":"11001","MessageTemplate":"Server farm with name {0} not found.","Parameters":["my-serviceplan"],"InnerErrors":null}}],"Innererror":null}
  At line:1 char:1
  + New-AzureResource -Name MyTestSite -Location "West Europe" -ResourceGrou ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : CloseError: (:) [New-AzureResource], ErrorResponseMessageException
  + FullyQualifiedErrorId : NotFound,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceCmdlet
  </code></pre>
  
  <p>What am I missing?</p>