title: Replacement of Context_Info SQL Azure
body: <p>I am currently using the CONTEXT_INFO property of the Master database for storing the logged in username to use it later in Table Triggers for auditing.</p>
  
  <p>While migrating to SQL Azure, the issue of Cross-Database connections popped and I couldn't find direct solutions to this issue.</p>
  
  <p>Following are the Issue Details:</p>
  
  <ol>
  <li>I call Stored Procedure XXX from Data Access Layer and pass the Username as Parameter</li>
  <li>The username is used to set the CONTEXT_INFO value in XXX</li>
  <li>The CONTEXT_INFO value is then used in Tables Insert/Update/Delete Triggers to Store Username for Application Auditing</li>
  </ol>
  
  <p>Solutions that I found so far:</p>
  
  <ol>
  <li>Create Table In Database to work as CONTEXT_INFO</li>
  <li>Use 2 Connection Strings in Data Access Layer, one for Master Database (to set CONTEXT_INFO) and the other is for the application and execute the SET CONTEXT_INFO each time before opening the connection to my application</li>
  </ol>
  
  <p>But I find both solutions risky, specially when expanding the Database over multiple SQL Azure Databases in the future.</p>
  
  <p>Appreciate your support.</p>