i used like this, which works fine for me. you can download the sample project to explore :) Sample Project for Azure + SSRS + MVC4
DataSourceCredentials cred = new DataSourceCredentials();
cred.Name = "DataSource1";
cred.UserId = "YourSQLServerLogin"; // this is the UserID which you used to Connect SQL
cred.Password = "YourSQLServerPassword";
ReportViewer1.ShowParameterPrompts = false;
ReportViewer1.ShowCredentialPrompts = false;
if(!this.IsPostBack) // make Sure you add this, or else Reporting will go in infinite loop.
{
try
{
ReportViewer1.ServerReport.ReportServerUrl =
new Uri(ConfigurationManager.AppSettings["SERVER_NAME"]);
ReportViewer1.ServerReport.ReportPath =
ConfigurationManager.AppSettings["REPORT_PATH"];
ReportViewer1.ServerReport.ReportServerCredentials = new ReportCredential();
ReportViewer1.ServerReport.SetDataSourceCredentials(new DataSourceCredentials[] { cred });
}
catch (Exception ex)
{
throw;
}
}
public class ReportCredential : IReportServerCredentials
{
public WindowsIdentity ImpersonationUser
{
get
{
return null;
}
}
public ICredentials NetworkCredentials
{
get
{
return null;
}
}
public bool GetFormsCredentials(out Cookie authCookie,
out string user, out string password, out string authority)
{
authCookie = null;
user = ConfigurationManager.AppSettings["USERNAME"];
password = ConfigurationManager.AppSettings["PASSWORD"];
authority = ConfigurationManager.AppSettings["SERVER_NAME"];
return true;
}
}