Project: Chef InSpec (Provisioning / Security & Compliance)
File: azurerm_ad_user.md

+++ title = "azurermaduser resource" draft = false gh_repo = "inspec" platform = "azure" [menu] [menu.inspec] title = "azurermaduser" identifier = "inspec/resources/azure/azurermaduser.md azurermaduser resource" parent = "inspec/resources/azure" +++ {{< warning >}} This resource will be deprecated when version 2 of the inspec-azure resource pack is released. {{< /warning >}} Use the `azurermaduser` InSpec audit resource to test properties of an Azure Active Directory user within a Tenant. This resource interacts with version `1.6` of the Azure Graph API. For more information see the . At the moment, there doesn't appear to be a way to select the version of the Azure API docs. If you notice a newer version being referenced in the official documentation please open an issue or submit a pull request using the updated version. This resource is available in the `inspec-azure` [resource pack](/inspec/glossary/#resource-pack). To use it, add the following to your `inspec.yml` in your top-level profile: depends: name: inspec-azure git: https://github.com/inspec/inspec-azure.git You'll also need to setup your Azure credentials; see the resource pack . This resource first became available in 1.1.0 of the inspec-azure resource pack. The `user_id` must be given as a parameter. describe azurermaduser(user_id: 'someUserId') do it { should exist } end If an Active Directory user account is referenced with a valid ID describe azurermaduser(user_id: 'someValidId') it { should exist } end If an Active Directory user account is referenced with an invalid ID describe azurermaduser(user_id: 'someInvalidId') it { should_not exist } end `user_id` `user_id` is a required parameter. describe azurermaduser(user_id: 'MyUserId') do ... end `object_id` `account_enabled` `city` `country` `department` `displayName` `facsimiletelephonenumber` `given_name` `job_title` `mail` `mail_nickname` `mobile` `password_policies` `password_profile` `postal_code` `state` `street_address` `surname` `telephone_number` `usage_location` `userprincipalname` `user_type` The user's object ID. Whether the account is enabled. The user's city. The user's country. The user's department. The display name of the user. the user's facsimile (fax) number. the given name for the user. the user's job title. the primary email address of the

The mail alias for the user. The user's mobile (cell) phone number. The password policies for the user. The password profile for the user. The user's postal (ZIP) code. The user's state. The user's street address. The user's surname (family name or last name). The user's telephone number. A two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". The principal name of the user. A string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. There are additional attributes that may be accessed that we have not documented. Please take a look at the . Any attribute in the response may be accessed with the key names separated by dots (`.`). Given the example response in their documentation: ``` ... "preferredLanguage": "en-US", "provisionedPlans": [ { "capabilityStatus": "Enabled", "provisioningStatus": "Success", "service": "exchange" }, ... ``` We may access `provisioningStatus` with: ```ruby its('provisionedPlants.first.provisioningStatus') { should eq "Success" } ``` The API may not always return keys that do not have any associated data. There may be cases where the deeply nested property may not have the desired attribute along your call chain. If you find yourself writing tests against properties that may be nil, fork this resource pack and add an accessor to the resource. Within that accessor you'll be able to guard against nil keys. Pull requests are always welcome. {{< readfile file="content/inspec/reusable/md/inspecmatcherslink.md" >}} This resource has the following special matchers. describe azurermaduser(user_id: 'someUserId') do it { should exist } end The Client/Active Directory Application you have configured InSpec Azure to use (`AZURECLIENTID`) must have permissions to read User data from the Azure Graph RBAC API. Please refer to the for information on how to grant these permissions to your application. Note: An Azure Admin must grant your application these permissions.