using PowerShell, Azure AD authenticaion, SMO, and Azure SQL DB?


  • How does one correctly connect to a Azure SQL DB using the latest SqlServer module, Azure AD authentication, and the SMO object. I'd like to be able to script login management items without having to open a SSMS session. ie: add / remove users to a role and enumerate existing user(s) in role(s).

    Our "database admin" accounts use a Azure AD group for authentication. The "New-PSDrive" method doesn't work and neither does "Invoke-SQLCmd" from what I can piece together. All the examples seem to use SQL authentication or the really old method of manually building a connection object.

    If I run:  cd SQLSERVER:\sql\\DEFAULT\Databases\DATABASE\

    I just get RPC errors and Windows logins aren't supported.

    miercuri, 13 iunie 2018 19:16

Toate mesajele