title: Grant Azure Function in staging slot MSI access to the SQL Server Database
body: <p>I have an Azure Function (function-name) for which I granted MSI access to the SQL Server Database using the following sql query:</p>
  <pre><code>IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'function-name')
  BEGIN
   CREATE USER [function-name] FROM EXTERNAL PROVIDER;
   ALTER ROLE db_datareader ADD MEMBER [function-name];
  END
  </code></pre>
  <p>I added a staging deployment slot. How do I grant function-name in staging slot MSI access to the SQL Server Database?</p>