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

Support for adding Azure AD admin user on Azure Database for MySQL server #7607

Closed
AdamCoulterOz opened this issue Jul 7, 2020 · 3 comments · Fixed by #7621
Closed

Support for adding Azure AD admin user on Azure Database for MySQL server #7607

AdamCoulterOz opened this issue Jul 7, 2020 · 3 comments · Fixed by #7621

Comments

@AdamCoulterOz
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Azure Database for MySQL supports adding an Azure AD administrator account for the MySQL server, but the Azure provider for Terraform doesn't have any facility for this. A new resource equivalent to these should be created for this:

  • azurerm_sql_active_directory_administrator (Azure SQL)
  • azurerm_postgresql_active_directory_administrator (PostgreSQL)

Relevant MS docs:

New or Affected Resource(s)

azurerm_mysql_active_directory_administrator

Potential Terraform Configuration

resource "azurerm_mysql_active_directory_administrator" "example" {
  server_name         = azurerm_mysql_server.example.name
  login               = data.azuread_user.admin_user.mail
  user_object_id      = data.azuread_user.admin_user.object_id

   // can we avoid needing to set a resource group?
   // it can only ever be the same as the `azurerm_mysql_server.example`
  resource_group_name = azurerm_resource_group.example.name

   // does this need to be set if it can only ever be the tenant_id 
   // ... of the `azurerm_mysql_server.example`?
  tenant_id           = data.azurerm_client_config.current.tenant_id
}
@evertonmc
Copy link
Contributor

Configuration will use the same format as the referenced existing resources

resource "azurerm_mysql_active_directory_administrator" "example" {
  server_name         = azurerm_mysql_server.example.name
  resource_group_name = azurerm_resource_group.example.name
  login               = "sqladmin"
  tenant_id           = data.azurerm_client_config.current.tenant_id
  object_id           = data.azurerm_client_config.current.object_id
}

katbyte pushed a commit that referenced this issue Jul 9, 2020
Fixes #7607

TF_ACC=1 go test -timeout 0 -v "./azurerm/internal/services/mysql/tests" -run="TestAccAzureMySqlAdministrator"
--- PASS: TestAccAzureMySqlAdministrator_requiresImport (376.06s)
--- PASS: TestAccAzureMySqlAdministrator_disappears (845.01s)
--- PASS: TestAccAzureMySqlAdministrator_basic (1546.86s)
PASS
@katbyte katbyte added this to the v2.18.0 milestone Jul 9, 2020
@ghost
Copy link

ghost commented Jul 10, 2020

This has been released in version 2.18.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.18.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Aug 9, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants