Add support for CREATE AADUSER to mysql_user resource #77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supports creating users authorized by AzureAD tokens instead of passwords https://learn.microsoft.com/en-us/azure/mysql/flexible-server/concepts-azure-ad-authentication
Although aad_auth is MySQL plugin and there is theoretical possibility to use
CREATE USER ... IDENTIFIED WITH 'aad_auth' AS 'AADUser:objectid:upn:objectname'
, this is currently not documented solution. As aad_auth is in public preview only, there is no guarantee this command would work.Therefore I tried to follow documentation and implement Microsoft specific
CREATE AADUSER
command as much as possible complying with documentation.What this PR can do:
Leads to
CREATE AADUSER 'some.user@exampe.onmicrosoft.com'@'localhost' AS 'someuser'
@hostname
in this statement is undocumented by Microsoft, but works. Microsoft defualts it to%
when ommited and it's up to everyone if he will try to use it another wayuser
to equalaad_identity
what is Microsoft's defaultsaad_identity
, there is allowed group name, which then works same as for user principals.aad_identity
which then leads to queryCREATE AADUSER alias@hostname IDENTIFIED BY clientid
which is stupid, but it's according to something i found on Microsoft's support.Only thing, where I depend on authentication data is in import, where I parse it back to
aad_identity
I did not wrote any tests of
auth_plugin = aad_auth
since I don't know if there is any possibility to run them in pipeline then asCREATE AADUSER
is supported only in Azure managed servers.I'm aware, that code is not nice, I tried above explain why. If you think, it can be improoved, please show me direction and I will try to do my best.