title: "Parameter x-ms-client-principal-name is null or empty" when deploying a Function App with Source Control link in VSTS
body: <p>I want to automatically deploy a Consumption Plan based Function App in my DEV/TEST/PROD instances. For that I started creating a Function App manually in the Portal, copy/pasted the automation script and incorporated it into my ARM template project.
  To have my source code automatically deployed to the Function App I integrated the link to the repo/branch in the template:</p>
  
  <pre><code>        "resources": [
              {
                  "apiVersion": "2015-08-01",
                  "name": "web",
                  "type": "sourcecontrols",
                  "dependsOn": [
                      "[concat('Microsoft.Web/sites/', parameters('name'))]"
                  ],
                  "tags": {
                      "displayName": "fnSourceControl"
                  },
                  "properties": {
                      "repoUrl": "[parameters('repoUrl')]",
                      "branch": "[parameters('repoBranch')]",
                      "isManualIntegration": false
                  }
              }
          ]
  </code></pre>
  
  <p>That just works fine when deploying from VS or from command line. Resource Group is created with the Function App and code is deployed into it: <strong>Magic!</strong> However when deploying from a VSTS release definition, the deployment fails with:</p>
  
  <pre><code>Resource Microsoft.Web/sites/sourcecontrols 'myFunctionApp/web' failed with message '{
    "Code": "BadRequest",
    "Message": "Parameter x-ms-client-principal-name is null or empty.",
    "Target": null,
    "Details": [
      {
        "Message": "Parameter x-ms-client-principal-name is null or empty."
      },
      {
        "Code": "BadRequest"
      },
      {
        "ErrorEntity": {
          "Code": "BadRequest",
          "Message": "Parameter x-ms-client-principal-name is null or empty.",
          "ExtendedCode": "51011",
          "MessageTemplate": "Parameter {0} is null or empty.",
          "Parameters": [
            "x-ms-client-principal-name"
          ],
          "InnerErrors": null
        }
      }
    ],
    "Innererror": null
  }
  </code></pre>
  
  <p>This question is related to <a href="https://stackoverflow.com/questions/40829023/vsts-deployment-of-function-app-fails-with-authorization-failed-for-of-type">my other question</a> regarding the 'Microsoft.Storage/storageAccounts/providers/locks' deployment problem. I guess it goes into the same direction. I did not want to overload one question mixing both problems.</p>