Connect to Azure SQL database with Azure AD Interactive authentication from Excel, Power Query

Ted Johansson 0 Reputation points
2023-12-11T07:21:31.62+00:00

I wonder if it is possible to connect to an Azure SQL database with ActiveDirectoryInteractive authentication from Excel with Power Query?
Is there support for it and if so how would the connection string be like.
I have tried to connect with the following code, and with similar varieities:

 cnString = _ 
    "OLEDB;Provider=MSOLEDBSQL.1;Persist Security Info=True;Authentication=ActiveDirectoryInteractive;Data Source=SERVERNAME;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Use Encryption for Data=True;Tag with column collation when possible=False;Initial Catalog=DATABASE;" 
     
    ThisWorkbook.Connections.Add2 _ 
    Name:="NAME", _ 
    Description:="", _ 
    ConnectionString:=cnString, _ 
    CommandText:="[TABLE]", _ 
    lCmdtype:=XlCmdType.xlCmdTable, _ 
    CreateModelConnection:=True, _ 
    ImportRelationships:=False

I get the authentication prompt to authenticate with my AD account and it succeeds but then I still get the Excel native login prompt as in attahced image and then the connection fails.

So I wonder, is it even possible to connect with Azure AD Interactive authentication in this way?
And if so how?

Azure SQL Database
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
2,088 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 29,502 Reputation points Microsoft Employee
    2023-12-12T01:26:12.8566667+00:00

    Hi, @Ted Johansson Welcome to Microsoft Q&A thanks for posting your question.

    I see It's not mentioned as an option for AAD in this documentation: Data authentication for Excel Online in Office Online Server - Office Online Server | Microsoft Learn

    However, I will check with internal team and provide you with more details.

    Regards

    Geetha


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.