Skip to content

Commit

Permalink
Example authenticating with AzureAD (#135)
Browse files Browse the repository at this point in the history
* Use azuread mssql driver

* spacing
  • Loading branch information
brian-pickens authored Jun 12, 2024
1 parent c13a4ae commit 15fe45b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,19 @@ dsn := "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
db, err := gorm.Open(sqlserver.Open(dsn), &gorm.Config{})
```

## Azure AD Auth

```go
import (
"github.com/microsoft/go-mssqldb/azuread"
"gorm.io/driver/sqlserver"
"gorm.io/gorm"
)

// github.com/microsoft/go-mssqldb
dsn := "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
dialector := &sqlserver.Dialector{Config: &sqlserver.Config{DSN: dsn, DriverName: azuread.DriverName}}
db, err := gorm.Open(dialector, &gorm.Config{})
```

Checkout [https://gorm.io](https://gorm.io) for details.

0 comments on commit 15fe45b

Please sign in to comment.