Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new login support for Azure SQL Dbs #5102

Merged
merged 2 commits into from
Feb 19, 2019

Conversation

cdhunt
Copy link
Contributor

@cdhunt cdhunt commented Feb 19, 2019

Type of Change

  • Bug fix (non-breaking change, fixes New-DbaLogin does not work on Azure SQL "Keyword or statement option 'hashed' is not supported" #5100
  • New feature (non-breaking change, adds functionality)
  • Breaking change (effects multiple commands or functionality)
  • Ran manual Pester test and has passed (`.\tests\manual.pester.ps1)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/sqlcollaborative/appveyor-lab ?
  • Nunit test is included
  • Documentation
  • Build system

Purpose

Add Azure SQL Db support.

Approach

An extra conditional branched based on $server.DatabaseEngineType.

Commands to test

New-DbaLogin -Login $UserName -SecurePassword $Password

Screenshots

Learning

@potatoqualitee
Copy link
Member

awwww yeahh! thank you, fabulous addition. will merge when tests pass 💯

@potatoqualitee
Copy link
Member

Tests pass! Gonna merge, do a few other PRs and publish to gallery. Thanks so much!

@potatoqualitee potatoqualitee merged commit df87c22 into dataplat:development Feb 19, 2019
@wsmelton
Copy link
Member

@potatoqualitee This needs to include a validation that if a login name is passed with @ to throw a warning that it does not support creating Azure Logins for Azure AD accounts. It will be a bit misleading if we say the command supports creating "Azure SQL Logins", it will be strictly SQL Logins.

@cdhunt
Copy link
Contributor Author

cdhunt commented Feb 20, 2019

@wsmelton Can you provide some more context? I don't use Azure Logins. If you want to open a new issue, I can try and put in the extra validation.

@wsmelton
Copy link
Member

You cannot create an Azure SQL Login for an Azure AD account using "CREATE LOGIN [$loginName] FROM WINDOWS" + $withParams it will fail.

If we want to support both there has to be a same check for the type of database engine and then using the T-SQL "CREATE LOGIN [$loginName] FROM EXTERNAL PROVIDER" , that is all you can do for Azure AD accounts....there are no additional parameters and such. Logins in Azure SQL do not grant access to the databases, you have to explicitly create those after you create the login because there is no sysadmin role and such.

@cdhunt
Copy link
Contributor Author

cdhunt commented Feb 20, 2019

@wsmelton Would you suggest creating another condition at New-DbaLogin.ps1#L273 to add a AzureADLogin for $loginType?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New-DbaLogin does not work on Azure SQL "Keyword or statement option 'hashed' is not supported"
3 participants