Microsoft AZ-104 – Azure Admin Certification/Groups and Terraform

In a previous blog we talked about Azure AD and Tenant, Subscription, and User administration and how to map these functions to Terraform. In this blog we will continue this discussion but move onto Groups, IAM, and RBAC in Azure.

Groups are not only a good way to aggregate users but associate roles with users. Groups are the best way to associate roles and authorizations to users rather than associate them directly to a user. Dynamic groups are an extension of this but only available for Premium Azure AD and not the free layer.

Group types are Security and Microsoft 365. Security groups are typically associated with resource and role mappings to give users indirect association and responsibilities. The Microsoft 365 group provides mailbox, calendar, file sharing, and other Office 365 features to a user. This typically requires additional spend to get access to these resources while joining a security group typically does not cost anything.

Membership types are another group association that allows users to be an assigned member, a dynamic member, or a device to be a dynamic device. An example of a dynamic user would look at an attribute associated with a user and add them to a group. If, for example, someone lives in Europe they might be added to a GDPR group to host their data in a specific way that makes then GDPR compliant.

Role based access control or RBAC assign roles to a user or group to give them rights to perform specific functions. Some main roles in Azure are Global Administrator, User Administrator, or Billing Administrator. Traditional Azure roles include Owner, Contributor, Reader, or Administrator. Custom roles like backup admin or virtual machine admin can be added or created as desired to allow users to perform specific functions or job duties. Processes or virtual machines can be assigned RBAC responsibilities as well.

Groups are a relatively simple concept. You can create a Security or Microsoft 365 Group. The membership type can be Assigned, Dynamic, or Dynamic Device if those options are enabled. For corporate accounts they are typically enabled but for evaluation or personal accounts they are typically disabled.

Note that you have two group types but the Membership type is grey and defaults to Assigned. If you do a search in the azuread provider you can reference an azuread_group with data sources or create and manage an azuread_group with resources. For a data source azuread_group either name or object_id must be specified. For a resource azuread_group a name attribute is required but description and members are not mandatory. It is important to note that the group definition default to security group and there is no way to define a Microsoft 365 group through Terraform unless you load a custom personal provider select this option.

If you a search for group in the azurerm provider you get a variety of group definitions but most of these refer to the resource group and not groups associated with identity and authentication/authorization. Alternatively, groups can refer to storage groupings or sql groups for sql clusters. There are no group definitions like there were user definitions in the azurerm provider.

provider "azuread" {
}

resource "azuread_group" "simple_example" {
  name   = "Simple Example Group"
}

resource "azuread_user" "example" {
  display_name          = "J Doe"
  password              = "notSecure123"
  user_principal_name   = "jdoe@hashicorp.com"
}

resource "azuread_group" "example" {
  name    = "MyGroup"
  members = [
    azuread_user.example.object_id,
    /* more users */
  ]
}

data "azuread_group" "existing_example" {
  name = "Existing-Group"
}


resource "azuread_group_member" "example" {
  group_object_id   = azuread_group.example.id
  member_object_id  = data.azuread_user.example.id
}

In summary, group management from Terraform handles the standard use case for user and group management. Users can be created as a standard Azure AD user and associated with a Security group using the azuread_group_member resource. Existing groups can be declared with the data declaration or created with the resource declaration. Group members can be associated and deleted using Terraform. Not all the group functionality that exists in Azure is replicated in Terraform but for the typical use case all functionality exists. Best practice would suggest to do group associations and user definitions outside of Terraform using scripting. Terraform can call these scripts using local-exec commands rather than trying to make everything work inside of Terraform declarations.

93 thoughts on “Microsoft AZ-104 – Azure Admin Certification/Groups and Terraform”

  1. Приветствую Вас дамы и господа!

    Есть такой интересный сайт https://ruposters.ru/

    Из последних новостей шоу бизнеса узнал, что:Знаменитости из России Лобода и Константин Меладзе поселились в Латвии, а детей пристроили в элитные школы.

    А певец Николай Басков впервые высказался по политической теме, осудив бежавших звезд из России.

    Рэпер Тимати посетил военный госпиталь, и привез около полусотни средств реабилитации для раненных военнослужащих, чтобы те быстрее возвращались к обычной жизни.

    От всей души Вам всех благ!

  2. Доброго времени суток дамы и господа!
    Есть такой интересный сайт https://dengi-do-zarplaty.ru/
    Отличные наличные – ведущая компания в сфере микрокредитования, деньги будут у вас на карте через 15 минут. Оформить займ можно круглосуточно, в выходные и праздники.Мы применяем самые передовые технологии, чтобы вы могли за 15 минут получить займ на карту или наличными.Наш сервис доступен везде где есть интернет, получить деньги можно в одном из наших отделений или круглосуточно не выходя из дома.

  3. Приветствую Вас господа!
    Есть такой интересный сайт https://dengi-do-zarplaty.ru/
    Чтобы оформить деньги в долг, вам не нужен специальный пакет документов, достаточно только паспорта. Это выгодно отличает микрофинансовые компании от банков в, которые требуют собрать несколько бумаг, на подготовку которых уходит пара дней.В заключение стоит сказать, что взять средства в МФО — простой и быстрый способ решения денежных проблем. Компании предоставляют множество заемных линий для людей с разными возможностями, поэтому вы обязательно найдете подходящий вариант. Главное — грамотно распорядиться займом и не тратить деньги на ненужные вещи.

  4. A lot of thanks for each of your labor on this web page. Betty takes pleasure in setting aside time for research and it’s obvious why. A lot of people notice all concerning the powerful manner you make very useful suggestions on your blog and as well recommend contribution from others on this article plus our princess is undoubtedly starting to learn a lot of things. Take advantage of the remaining portion of the new year. You are conducting a useful job.

  5. I want to voice my admiration for your generosity giving support to those people who actually need help with your niche. Your very own commitment to getting the solution all-around became remarkably significant and have continuously made workers just like me to attain their dreams. Your helpful tips and hints denotes a great deal to me and substantially more to my mates. Warm regards; from all of us.

  6. I’m just commenting to make you understand of the perfect discovery our princess encountered browsing yuor web blog. She figured out so many details, with the inclusion of how it is like to possess an awesome giving heart to get the rest completely master specified extremely tough topics. You truly surpassed readers’ desires. I appreciate you for supplying these valuable, healthy, edifying and even fun tips on that topic to Ethel.

  7. I intended to post you the bit of remark just to thank you yet again about the pleasant tactics you have shared at this time. This has been so particularly open-handed with people like you to grant easily exactly what numerous people could possibly have offered for sale for an ebook to help with making some profit for themselves, most importantly since you might well have tried it if you ever considered necessary. Those secrets likewise worked to become a easy way to be sure that most people have the identical dreams just like my own to realize significantly more related to this issue. I am certain there are several more pleasurable periods up front for individuals who looked at your website.

  8. I needed to send you one bit of note to give thanks once again for your pleasant thoughts you’ve featured in this article. It was simply tremendously generous with people like you to provide without restraint what a few people would’ve supplied for an e-book to help make some money for themselves, most importantly given that you could possibly have tried it if you wanted. Those advice as well acted to provide a easy way to be sure that other people online have a similar zeal the same as my own to grasp a lot more on the topic of this condition. I’m certain there are lots of more fun moments in the future for people who read your site.

  9. Needed to compose you that little bit of word to finally give thanks the moment again about the spectacular guidelines you have featured in this case. It has been simply open-handed with you to supply unhampered all a few individuals could possibly have marketed for an e book to end up making some dough on their own, notably seeing that you could have done it if you decided. Those ideas additionally served as a good way to know that other individuals have the same fervor similar to my personal own to see very much more when considering this issue. I’m sure there are numerous more fun moments in the future for those who looked at your blog post.

  10. I simply wanted to jot down a quick remark in order to appreciate you for all the lovely ideas you are showing here. My extensive internet research has at the end been recognized with extremely good ideas to talk about with my neighbours. I would say that we website visitors are rather fortunate to dwell in a useful website with many lovely professionals with interesting plans. I feel really happy to have discovered your website page and look forward to some more amazing moments reading here. Thank you again for everything.

Leave a Reply

Your email address will not be published. Required fields are marked *