title: Setting Azure Function app settings using Powershell Set-AzureRmWebApp function fails with Bad Request error
body: <p>I want to set an existing Azure function's app settings from Powershell. I have the following script</p>
  
  <pre><code>$FunctionSettings = @{     
      "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING" = "*******";    
      "WEBSITE_CONTENTSHARE" = "TestFunction123";
      "AzureWebJobsStorage" = "*******";    
      "FUNCTIONS_EXTENSION_VERSION" = "~2";
      "FUNCTIONS_WORKER_RUNTIME" = "dotnet";       
      "WEBSITE_NODE_DEFAULT_VERSION" = "10.14.1";    
  }
  
  Set-AzureRmWebApp -ResourceGroupName "RGN" -AppSettings $FunctionSettings -Name "TestFunction"
  </code></pre>
  
  <p>Running this script returns this error</p>
  
  <blockquote>
    <p>Set-AzureRmWebApp : Operation returned an invalid status code
    'BadRequest'
        At C:\Users******\Source\Repos*******\Create Azure infrastructure.ps1:101 char:1
        + Set-AzureRmWebApp -ResourceGroupName $AzureResourceGroupName -AppSett ...
        + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : CloseError: (:) [Set-AzureRmWebApp], DefaultErrorResponseException
            + FullyQualifiedErrorId : Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps.SetAzureWebAppCmdlet</p>
  </blockquote>
  
  <p>If I remove the WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE from $FunctionSettings then the script runs successfully but I get errors in the Azure UI because those properties are required.</p>
  
  <p>How can I fix this?</p>