简体   繁体   English

从Node.js连接Azure分析服务

[英]Connecting Azure Analysis services from Node.js

I am trying to connect Azure Analysis Services with connection string from Node js api. 我正在尝试使用来自Node js api的连接字符串连接Azure Analysis Services。 I am using OLEDB module for this connectivity. 我正在使用OLEDB模块进行此连接。

Problem is: When I try to connect, Login prompt is getting popped out automatically. 问题是:当我尝试连接时,登录提示会自动弹出。 I want this flow to happen without any prompt. 我希望这种流程在没有任何提示的情况下发生。

Is there any solution or specific properties for connection string to do this? 连接字符串有解决方案或特定属性吗?

You can add a Service Principle to your database and add its info to your connection string as a username and password. 您可以将服务原理添加到数据库中 ,并将其信息作为用户名和密码添加到连接字符串中。 This will prevent the need for a popup. 这将避免需要弹出窗口。

const oledb = require('oledb');

var appId = "appId";
var authKey = "appSecret";
var connectionString = `Provider=MSOLAP;Data Source=asazure://aspaaseastus2.asazure.windows.net/(servername);Initial catalog=(database name);User ID=app:${appId};Password=${authKey};`;

const db = oledb.oledbConnection(connectionString);

db.query(`EVALUATE
            CALCULATETABLE(
                Customer,
                Customer[First Name] = "Aaron" )`
    ).then(result => {
        console.log(result);
    },
    err => {
        console.error(err);
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM