I am trying to retrieve data from Azure Analysis Services using ADOMD.NET from a deployed model in cloud. The code snippet is as below, but i am getting an error that the ConnectionString in invalid.
using Microsoft.AnalysisServices.AdomdClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test_Analysis_Service_retrieval
{
class Program
{
static void Main(string[] args)
{
string queryString = @"SELECT [MAP_CUST_NAME] FROM [AAS_MAPLOOKUP] where [MAP_ACT_NO] = '120000810';";
string connectionString = @"Data Source=asazure://westus.asazure.windows.net/bbacloud;UserName=xyz@gmail.com;Password=ABC@123;";
using (AdomdConnection connection = new AdomdConnection(connectionString))
{
CellSet AASOutput = null;
System.Xml.XmlReader reader = null;
try
{
string s = connection.ConnectionString;
Console.WriteLine(s);
connection.Open();
AdomdCommand command = new AdomdCommand(queryString, connection);
command.CommandTimeout = 100000;
reader = command.ExecuteXmlReader();
Console.WriteLine(reader.ReadOuterXml());
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
if (reader != null)
{
reader.Close();
}
connection.Close();
}
}
}
}
}