FormsAuthentication.SetAuthCookie throwing NullReferenceException in async action
This issue is not specific to Azure - the method FormsAuthentication.SetAuthCookie will throw a null reference exception in an async action when an await statement is called before FormsAuthentication.SetAuthCookie is called.
The easiest solution is to use the following:
Response.Cookies.Add(FormsAuthentication.GetAuthCookie("user-1", true));
An alternative would be to specify the ticket creation yourself:
var ticket = new FormsAuthenticationTicket(
2,
"user-1",
DateTime.Now,
DateTime.Now.AddDays(2),
true,
String.Empty,
"/");
var encTicket = FormsAuthentication.Encrypt(ticket);
Response.Cookies.Add(new HttpCookie(".AUTH", encTicket));