title: ARM Template: Service Principal for a newly generated App Site
body: <p>I'm wondering if I'm going about this wrong... but still....</p>
  
  <p>For security reasons, it would be preferred that an App used integrated security to talk to its database, using the app's Service Principal AAD account. </p>
  
  <p>But how to set this up using ARMs, hopefully with no manual steps?</p>
  
  <p>For example, when creating an ARM that creates an environment from scratch, starting with the App Service... how does one create an App Service Principal (or trigger the creation of one automatically?), in order to use it as a parameter when developing the new sql server and database?</p>
  
  <p>Can one set up a Service Principal account <em>before</em> an app is installed, and then associate it to the newly installed app? That way one could pass the name of the Service Principal as Parameters.</p>
  
  <p>Thank you for any advice on whether:</p>
  
  <ol>
  <li>it's actually possible (maybe ARMs actually can't be pushed that far, and security accounts are considered outside the scope of infrastructure provisioning), </li>
  <li>if so, how!?!</li>
  </ol>
  
  <p>Thank you.</p>