Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions articles/azure-sql/database/connect-query-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,34 @@ Open a command prompt and create a folder named *sqltest*. Open the folder you c
encrypt: true
}
};

/*
//Use Azure VM Managed Identity to connect to the SQL database
const connection = new Connection({
server: process.env["db_server"],
authentication: {
type: 'azure-active-directory-msi-vm',
},
options: {
database: process.env["db_database"],
encrypt: true,
port: 1433
}
});
//Use Azure App Service Managed Identity to connect to the SQL database
const connection = new Connection({
server: process.env["db_server"],
authentication: {
type: 'azure-active-directory-msi-app-service',
},
options: {
database: process.env["db_database"],
encrypt: true,
port: 1433
}
});

*/

const connection = new Connection(config);

Expand Down Expand Up @@ -148,6 +176,9 @@ Open a command prompt and create a folder named *sqltest*. Open the folder you c
}
```

> [!NOTE]
> For more information about using managed identity for authentication, complete the tutorial to [access data via managed identity](../../app-service/app-service-web-tutorial-connect-msi.md).

> [!NOTE]
> The code example uses the **AdventureWorksLT** sample database in Azure SQL Database.

Expand Down