Skip to main content

azure_graph_user Resource

[edit on GitHub]

Use the azure_graph_user InSpec audit resource to test properties of an Azure Active Directory user within a Tenant.

Azure REST API Version, Endpoint, and HTTP Client Parameters

This resource interacts with API versions supported by the resource provider. The api_version can be defined as a resource parameter. If not provided, this resource uses the latest version. For more information, refer to the azure_generic_resource document.

Unless defined, this resource uses the azure_cloud global endpoint and default values for the HTTP client. For more information, refer to the resource pack README.

Installation

This resource is available in the Chef InSpec Azure resource pack.

See the Chef InSpec documentation on cloud platforms for information on configuring your Azure environment for InSpec and creating an InSpec profile that uses the InSpec Azure resource pack.

Syntax

describe azure_graph_user(user_principal_name: 'jdoe@contoso.com') do
  it { should exist }
end

Parameters

Either one of the following parameters is mandatory.

user_principal_name
The user principal name.

Example: jdoe@contoso.com

id
Globally unique identifier.

Example: abcd-1234-efabc-5678

user_id
Globally unique identifier. (For backward compatibility.).

Example: abcd-1234-efabc-5678

Properties

id
The user’s globally unique ID.
account_enabled
Whether the account is enabled.
city
The user’s city.
country
The user’s country.
department
The user’s department.
display_name
The display name of the user.
facsimile_telephone_number
The user’s facsimile (fax) number.
given_name
The given name for the user.
job_title
The user’s job title.
mail
The primary email address of the user.
mail_nickname
The mail alias for the user.
mobile
The user’s mobile (cell) phone number.
password_policies
The password policies for the user.
password_profile
The password profile for the user.
postal_code
The user’s postal (ZIP) code.
state
The user’s state.
street_address
The user’s street address.
surname
The user’s surname (family name or last name).
telephone_number
The user’s telephone number.
usage_location
A two letter country code (ISO standard 3166). Examples include: US, JP, and GB.
user_principal_name
The principal name of the user.
user_type
A string value that can be used to classify user types in your directory, such as Member or Guest.

Examples

Test If an Active Directory User Account is Referenced with a Valid ID.

describe azure_graph_user(id: 'someValidId')
  it { should exist }
end

Test If an Active Directory User Account is Referenced with an Invalid ID.

describe azure_graph_user(id: 'someInvalidId')
  it { should_not exist }
end

Matchers

This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.

exists

describe azure_graph_user(user_id: 'someUserId') do
  it { should exist }
end

Azure Permissions

Graph resources require specific privileges granted to your service principal. Please refer to the Microsoft Documentation for information on how to grant these permissions to your application.

Was this page helpful?

×









Search Results