https://github.com/lenisha/node-vault-aad
Node and SQL Server AAD Auth test
https://github.com/lenisha/node-vault-aad
Last synced: 12 months ago
JSON representation
Node and SQL Server AAD Auth test
- Host: GitHub
- URL: https://github.com/lenisha/node-vault-aad
- Owner: lenisha
- Created: 2019-01-07T00:41:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-08T03:05:31.000Z (over 7 years ago)
- Last Synced: 2025-05-19T06:38:14.334Z (about 1 year ago)
- Language: JavaScript
- Size: 45.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test AAD authentication with Tedious driver on Azure App Service
To run the app:
- Create on Azure `Web App + SQL`
- Set AAD Admin on sql Database
- Create DB table and rows
```
CREATE TABLE [dbo].[assessment] (
[assessment_id] [nvarchar](max),
[assessment_status] [nvarchar](max),
[created_on] DATETIME,
[modified_on] DATETIME
)
GO
Insert into [dbo].[assessment] ( assessment_id, assessment_status) values ('1000', 'success');
Insert into [dbo].[assessment] ( assessment_id, assessment_status) values ('1002', 'retry');
select * from [dbo].[assessment];
```
- set App Service > App Settings (or locally variables)
```
AZURE_AD_PASS=
AZURE_AD_USER=@domain.onmicrosoft.com
AZURE_SQL_SRV=.database.windows.net
TEDIOUS_TDS_VERSION=7_4
WEBSITE_NODE_DEFAULT_VERSION=10.14.1
```
- Zip and Deploy to App service (e.g using Kudu https://scm.site/ZipDeployUI) or locally npm start
Error received:
```
Application has thrown an uncaught exception and is terminated:
Error: No event 'routingChange' in state 'SentLogin7Withfedauth'
at Connection.dispatchEvent (D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:1086:26)
at Parser.tokenStreamParser.on.token (D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:775:12)
at emitOne (events.js:96:13)
at Parser.emit (events.js:188:7)
at Parser.parser.on.token (D:\home\site\wwwroot\node_modules\tedious\lib\token\token-stream-parser.js:27:14)
at emitOne (events.js:96:13)
at Parser.emit (events.js:188:7)
at addChunk (D:\home\site\wwwroot\node_modules\readable-stream\lib\_stream_readable.js:296:12)
at readableAddChunk (D:\home\site\wwwroot\node_modules\readable-stream\lib\_stream_readable.js:278:11)
at Parser.Readable.push (D:\home\site\wwwroot\node_modules\readable-stream\lib\_stream_readable.js:239:10)
```
References:
https://docs.microsoft.com/en-us/sql/connect/node-js/step-3-proof-of-concept-connecting-to-sql-using-node-js?view=sql-server-2017
https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi
https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_load-environment-variables-from-external-file-node