title: Singleton time triggered Azure Function across multiple regions
body: <p>I have a time triggered Azure Function deployed in multiple regions and I want to have singleton behavior across them. For example, if the regions are west US and central Europe, I want only one of them to run each time. Can this be achieved?</p>
  
  <p>As the <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer#scale-out" rel="nofollow noreferrer">documentation</a> says, TimeTrigger uses the Singleton attribute implicitly to ensure only one instance of a function is run per host, so that aspect is covered.</p>
  
  <p>In order to have the same behavior in all regions, I tried using Singleton with the following parameters:</p>
  
  <pre><code>[Singleton(Account = "myAccount", Mode = SingletonMode.Listener)]
  </code></pre>
  
  <p>I tested it locally by copying my C# solution and running both projects. The following error was shown:</p>
  
  <pre><code>The listener for function 'MyFunction' was unable to start. 
  Microsoft.Azure.WebJobs.Host.Storage: Must replace singleton lease manager to 
  support multiple accounts.
  </code></pre>
  
  <p>I did not find information about the <code>Account</code> property more than from the metadata of the Singleton class, that says <code>Gets the name of the Azure Storage account that the blob lease should be created in</code>. I don't know how the function knows how to connect to the Storage and where to configure the connection.</p>