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

Initial support for Microsoft Graph with opt-in beta #373

Merged
merged 62 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
edb870a
Preliminary support for Microsoft Graph
manicminer Dec 14, 2020
3681234
Support Azure CLI authentication for MS Graph
manicminer Dec 14, 2020
b7c7dff
Parse claims in access tokens to surface useful authentication metada…
manicminer Dec 15, 2020
a8566eb
Update Hamilton SDK
manicminer Dec 15, 2020
fbabf7e
azuread_client_config: return an error is object_id is empty
manicminer Dec 15, 2020
7bac950
Fix bug in acceptance helper that fails to check a resource is deleted
manicminer Jan 13, 2021
9b96641
Vendor latest Hamilton changes, configure client authorizer and user …
manicminer Jan 13, 2021
fe4b93a
Helpers for Microsoft Graph
manicminer Jan 13, 2021
c3fc383
Microsoft Graph support for Applications
manicminer Jan 13, 2021
8e2ec58
Microsoft Graph support for Domains
manicminer Jan 13, 2021
c671e90
Microsoft Graph support for Groups
manicminer Jan 13, 2021
fa9b4f1
Microsoft Graph support for Service Principals
manicminer Jan 13, 2021
8ad6b16
Microsoft Graph support for Users
manicminer Jan 13, 2021
9ce8550
Remove unused common schema functions
manicminer Jan 13, 2021
435c23c
Improve provider acceptance tests
manicminer Jan 15, 2021
a14294f
Bump Hamilton to v0.6.0 for MSI auth support
manicminer Jan 26, 2021
813a063
Bump Hamilton to v0.7.0
manicminer Jan 27, 2021
81f5ff7
Update Hamilton to v0.8.0
manicminer Feb 2, 2021
2d3c912
Deprecation notice for the enable_msgraph provider attribute
manicminer Mar 10, 2021
b585e46
Remove hamilton mod override
manicminer Mar 30, 2021
86ea39f
Use `enable_msgraph_beta` provider attribute
manicminer Apr 7, 2021
c3e37a9
Don't call every cloud a national cloud
manicminer Apr 8, 2021
09db981
Dry out redundant err assignments
manicminer Apr 8, 2021
2624022
Upgrade hamilton to v0.10.0
manicminer Apr 10, 2021
0f0eef3
Upgrade hamilton to v0.11.0 for better error handling
manicminer Apr 13, 2021
ab019ac
Don't pre-size arrays for slices
manicminer Apr 14, 2021
a8ed16a
Provider adjustments for Microsoft Graph
manicminer Apr 15, 2021
7ef3633
Graph helpers
manicminer Apr 15, 2021
67d810a
Don't assign unused variable, use if in place of simple switch
manicminer Apr 15, 2021
0efb2f7
Don't preallocate slice arrays
manicminer Apr 15, 2021
c59c8ac
Use "empty" instead of "blank"
manicminer Apr 15, 2021
3bcf4b7
Ensure attributes are always set
manicminer Apr 15, 2021
d07577a
Do not mask disappearing resources when deleting from state
manicminer Apr 15, 2021
dc09b39
Ensure the oid claim is always present in the token and catch this at…
manicminer Apr 16, 2021
e464b2c
More crash mitigation
manicminer Apr 16, 2021
4df050e
Add support for new properties in azuread_application
manicminer Apr 17, 2021
3b5c114
Ensure new owners are added before old owners are removed for Applica…
manicminer Apr 21, 2021
51c8499
Provider: add the option to disable CLI authentication (the default r…
manicminer Apr 21, 2021
d0c2030
Upgrade guide for v2.0
manicminer May 4, 2021
a9ce167
Update v2.0 upgrade guide
manicminer May 5, 2021
42c11e4
Deprecated/new Attribute handling for Applications
manicminer May 10, 2021
af025f2
Docs updates and validation
manicminer May 11, 2021
dab1031
Update dependencies, deprecate azuread_application_oauth2_permission …
manicminer May 11, 2021
4bfce61
Update docs for remaining resources/data sources, update service prin…
manicminer May 11, 2021
784082f
MS Graph support for asuread_application_password and azuread_service…
manicminer May 11, 2021
4bf6041
More todos
manicminer May 11, 2021
f680f3f
Merge branch 'main' into feature/enable-microsoft-graph
manicminer May 11, 2021
c7fa48e
Proper deprecation for azuread_application_oauth2_permission resource
manicminer May 13, 2021
5cdc32a
Migration guide fixups
manicminer May 13, 2021
2cc48e0
Absolute URL probably betetr for linking between docs sections
manicminer May 17, 2021
c6ce6c1
Authentication and environment info in migration guide
manicminer May 18, 2021
0681240
Changelog for #373
manicminer May 18, 2021
8d8f987
Compatibility fixes for azuread_application_password and azuread_serv…
manicminer May 18, 2021
e56ebf2
Update Hamilton to v0.13.0
manicminer May 18, 2021
02a6a58
Upgrade Plugin SDK for Terraform 0.15 support
manicminer May 19, 2021
44e470f
Application role/scope values can be empty
manicminer May 19, 2021
d08ab44
AAD Graph test fixes
manicminer May 19, 2021
1015701
API-specific default for application / service principal password expiry
manicminer May 19, 2021
4cd4d74
Import check fixes for application_app_role and application_oauth2_pe…
manicminer May 19, 2021
b2de421
Fix dependencies and broken unit test, add missing validation
manicminer May 19, 2021
141b076
Update dependencies
manicminer May 19, 2021
1aea423
Fix text mangling for vendored files
manicminer May 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Do not mangle vendored files
vendor/** -text
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ website/vendor

# built binary
terraform-provider-azuread

# terraform version
.terraform-version
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## 1.5.0 (Unreleased)

NOTES:

* **Support for Microsoft Graph:** This release introduces beta support for [Microsoft Graph](https://docs.microsoft.com/en-us/graph/overview) in a way that is forward (and backward) compatible with the current [Azure Active Directory Graph](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-graph-api) API implementation. We do not recommend enabling this beta _in production_ at this time, but encourage you to try it out in test environments where minimal impact can occur if something doesn't work as expected. See the [Migration Guide](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/guides/microsoft-graph#beta-support-for-microsoft-graph-in-v150) for more details.

* **Deprecations:** This release contains a number of additional deprecations to aid in future upgrades to version 2.0 of this provider. These will be flagged when running Terraform, and are documented in detail in the [Migration Guide](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/guides/microsoft-graph). Existing configurations will continue to work unchanged for any v1.x release, regardless of which API is used.

IMPROVEMENTS:

* `data.azuread_user` - export the `user_type` attribute [GH-406]
Expand Down
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ docs-lint:
@echo "==> Checking documentation spelling..."
@misspell -error -source=text -i hdinsight -locale UK docs/
@echo "==> Checking documentation for errors..."
@tfproviderdocs check -provider-name=azuread -allowed-guide-subcategories=Authentication -enable-contents-check -require-schema-ordering -require-guide-subcategory -require-resource-subcategory
@tfproviderdocs check -provider-name=azuread -allowed-guide-subcategories="Authentication,Upgrade Guides" -enable-contents-check -require-schema-ordering -require-guide-subcategory -require-resource-subcategory
@sh -c "'$(CURDIR)/scripts/terrafmt-docs.sh'"

teamcity-test:
Expand Down
82 changes: 58 additions & 24 deletions docs/data-sources/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,36 @@ output "azure_ad_object_id" {

## Argument Reference

* `application_id` - (Optional) Specifies the Application ID of the Azure Active Directory Application.
* `display_name` - (Optional) Specifies the display name of the Application within Azure Active Directory.
* `object_id` - (Optional) Specifies the Object ID of the Application within Azure Active Directory.
* `application_id` - (Optional) Specifies the Application ID (also called Client ID).
* `display_name` - (Optional) Specifies the display name of the application.
* `object_id` - (Optional) Specifies the Object ID of the application.

~> **NOTE:** One of `object_id`, `application_id` or `display_name` must be specified.

## Attributes Reference

The following attributes are exported:

* `app_roles` - A collection of `app_role` blocks as documented below. For more information https://docs.microsoft.com/en-us/azure/architecture/multitenant-identity/app-roles
* `application_id` - the Application ID of the Azure Active Directory Application.
* `available_to_other_tenants` - Is this Azure AD Application available to other tenants?
* `api` - An `api` block as documented below.
* `app_roles` - A collection of `app_role` blocks as documented below. For more information see [official documentation on Application Roles](https://docs.microsoft.com/en-us/azure/architecture/multitenant-identity/app-roles).
* `application_id` - the Application ID (also called Client ID).
* `available_to_other_tenants` - (**Deprecated**) Is this Azure AD Application available to other tenants?
* `display_name` - The display name for the application.
* `fallback_public_client_enabled` - The fallback application type as public client, such as an installed application running on a mobile device.
* `group_membership_claims` - The `groups` claim issued in a user or OAuth 2.0 access token that the app expects.
* `id` - the Object ID of the Azure Active Directory Application.
* `homepage` - (**Deprecated**) The URL to the application's home page. This property is deprecated and has been replaced by the `homepage_url` property in the `web` block.
* `identifier_uris` - A list of user-defined URI(s) that uniquely identify a Web application within it's Azure AD tenant, or within a verified custom domain if the application is multi-tenant.
* `logout_url` - The URL of the logout page.
* `oauth2_allow_implicit_flow` - Does this Azure AD Application allow OAuth2.0 implicit flow tokens?
* `oauth2_permissions` - A collection of OAuth 2.0 permission scopes that the web API (resource) app exposes to client apps. Each permission is covered by a `oauth2_permission` block as documented below.
* `object_id` - the Object ID of the Azure Active Directory Application.
* `logout_url` - (**Deprecated**) The URL of the logout page. This property is deprecated and has been replaced by the `logout_url` property in the `web` block.
* `oauth2_allow_implicit_flow` - (**Deprecated**) Does this Azure AD Application allow OAuth2.0 implicit flow tokens?
* `oauth2_permissions` - (**Deprecated**) A collection of OAuth 2.0 permission scopes that the web API (resource) app exposes to client apps. Each permission is covered by a `oauth2_permission` block as documented below.
* `object_id` - The application's Object ID.
* `optional_claims` - A collection of `access_token` or `id_token` blocks as documented below which list the optional claims configured for each token type. For more information see https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-optional-claims
* `owners` - A list of User Object IDs that are assigned ownership of the application registration.
* `public_client` - Is this Azure AD Application available publicly?
* `reply_urls` - A list of URLs that user tokens are sent to for sign in, or the redirect URIs that OAuth 2.0 authorization codes and access tokens are sent to.
* `owners` - A list of Object IDs for principals that are assigned ownership of the application.
* `public_client` - (**Deprecated**) Is this Azure AD Application available publicly? This property is deprecated and has been replaced by the `fallback_public_client_enabled` property.
* `reply_urls` - (**Deprecated**) A list of URLs that user tokens are sent to for sign in, or the redirect URIs that OAuth 2.0 authorization codes and access tokens are sent to. This property is deprecated and has been replaced by the `redirect_uris` property in the `web` block.
* `required_resource_access` - A collection of `required_resource_access` blocks as documented below.
* `sign_in_audience` - The Microsoft account types that are supported for the current application. One of `AzureADMyOrg`, `AzureADMultipleOrgs`, `AzureADandPersonalMicrosoftAccount` or `PersonalMicrosoftAccount`.
* `web` - A `web` block as documented below.

---

Expand All @@ -61,16 +66,35 @@ The following attributes are exported:

`app_role` block exports the following:

* `allowed_member_types` - Specifies whether this app role definition can be assigned to users and groups, or to other applications (that are accessing this application in daemon service scenarios). Possible values are: `User` and `Application`, or both.
* `description` - Permission help text that appears in the admin app assignment and consent experiences.
* `display_name` - Display name for the permission that appears in the admin consent and app assignment experiences.
* `allowed_member_types` - Specifies whether this app role definition can be assigned to users and groups, or to other applications (that are accessing this application in a standalone scenario). Possible values are: `User` and `Application`, or both.
* `description` - Description of the app role that appears when the role is being assigned and, if the role functions as an application permissions, during the consent experiences.
* `display_name` - Display name for the app role that appears during app role assignment and in consent experiences.
* `id` - The unique identifier of the `app_role`.
* `is_enabled` - Determines if the app role is enabled.
* `value` - Specifies the value of the roles claim that the application should expect in the authentication and access tokens.
* `enabled` - Determines if the app role is enabled.
* `value` - The value that is used for the `roles` claim in ID tokens and OAuth 2.0 access tokens that are authenticating an assigned service or user principal.

---

`oauth2_permission` block exports the following:
`implicit_grant` block exports the following:

* `access_token_issuance_enabled` - Whether this web application can request an access token using OAuth 2.0 implicit flow.

---

`oauth2_permission_scope` block exports the following:

* `admin_consent_description` - (Required) Delegated permission description that appears in all tenant-wide admin consent experiences, intended to be read by an administrator granting the permission on behalf of all users.
* `admin_consent_display_name` - (Required) Display name for the delegated permission, intended to be read by an administrator granting the permission on behalf of all users.
* `enabled` - (Optional) Determines if the permission scope is enabled.
* `id` - (Required) The unique identifier of the delegated permission. Must be a valid UUID.
* `type` - (Required) Whether this delegated permission should be considered safe for non-admin users to consent to on behalf of themselves, or whether an administrator should be required for consent to the permissions. Possible values are `User` or `Admin`.
* `user_consent_description` - (Optional) Delegated permission description that appears in the end user consent experience, intended to be read by a user consenting on their own behalf.
* `user_consent_display_name` - (Optional) Display name for the delegated permission that appears in the end user consent experience.
* `value` - (Optional) The value that is used for the `scp` claim in OAuth 2.0 access tokens.

---

`oauth2_permission` block (deprecated) exports the following:

* `admin_consent_description` - The description of the admin consent
* `admin_consent_display_name` - The display name of the admin consent
Expand All @@ -85,12 +109,22 @@ The following attributes are exported:

`required_resource_access` block exports the following:

* `resource_access` - A collection of `resource_access` blocks as documented below
* `resource_app_id` - The unique identifier for the resource that the application requires access to.
* `resource_access` - A collection of `resource_access` blocks as documented below, describing OAuth2.0 permission scopes and app roles that the application requires from the specified resource.
* `resource_app_id` - The unique identifier for the resource that the application requires access to. This is the Application ID of the target application.

---

`resource_access` block exports the following:

* `id` - The unique identifier for one of the `OAuth2Permission` or `AppRole` instances that the resource application exposes.
* `type` - Specifies whether the id property references an `OAuth2Permission` or an `AppRole`.

* `id` - The unique identifier for one of the `OAuth2Permission` or `AppRole` instances that the resource application exposes.
* `type` - Specifies whether the `id` property references an `OAuth2Permission` or an `AppRole`. Possible values are `Scope` or `Role`.

---

`web` block exports the following:

* `homepage_url` - Home page or landing page of the application.
* `implicit_grant` - An `implicit_grant` block as documented above.
* `logout_url` - The URL that will be used by Microsoft's authorization service to sign out a user using front-channel, back-channel or SAML logout protocols.
* `redirect_uris` - A list of URLs where user tokens are sent for sign-in, or the redirect URIs where OAuth 2.0 authorization codes and access tokens are sent.
6 changes: 3 additions & 3 deletions docs/data-sources/groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Gets Object IDs or Display Names for multiple Azure Active Directory groups.

```terraform
data "azuread_groups" "groups" {
names = ["group-a", "group-b"]
display_names = ["group-a", "group-b"]
}
```

## Argument Reference

The following arguments are supported:

* `names` - (Optional) The Display Names of the Azure AD Groups.
* `display_names` - (Optional) The Display Names of the Azure AD Groups.
* `object_ids` - (Optional) The Object IDs of the Azure AD Groups.

~> **NOTE:** Either `names` or `object_ids` should be specified. Either of these _may_ be specified as an empty list, in which case no results will be returned.
Expand All @@ -29,5 +29,5 @@ The following arguments are supported:

The following attributes are exported:

* `names` - The Display Names of the Azure AD Groups.
* `display_names` - The Display Names of the Azure AD Groups.
* `object_ids` - The Object IDs of the Azure AD Groups.
25 changes: 19 additions & 6 deletions docs/data-sources/service_principal.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ data "azuread_service_principal" "example" {

The following arguments are supported:

* `app_roles` - A collection of `app_role` blocks as documented below. For more information https://docs.microsoft.com/en-us/azure/architecture/multitenant-identity/app-roles
* `application_id` - (Optional) The ID of the Azure AD Application.
* `display_name` - (Optional) The Display Name of the Azure AD Application associated with this Service Principal.
* `object_id` - (Optional) The ID of the Azure AD Service Principal.

~> **NOTE:** At least one of `application_id`, `display_name` or `object_id` must be specified.

* `oauth2_permissions` - A collection of OAuth 2.0 permissions exposed by the associated application. Each permission is covered by a `oauth2_permission` block as documented below.

## Attributes Reference

The following attributes are exported:

* `id` - The Object ID for the Service Principal.
* `app_roles` - A collection of `app_roles` blocks as documented below. For more information [official documentation](https://docs.microsoft.com/en-us/azure/architecture/multitenant-identity/app-roles).
* `object_id` - The Object ID for the Service Principal.
* `oauth2_permission_scopes` - A collection of OAuth 2.0 delegated permissions exposed by the associated Application. Each permission is covered by an `oauth2_permission_scopes` block as documented below.
* `oauth2_permissions` - (**Deprecated**) A collection of OAuth 2.0 permissions exposed by the associated Application. Each permission is covered by an `oauth2_permissions` block as documented below. Deprecated in favour of `oauth2_permission_scopes`.

---

`app_role` block exports the following:
`app_roles` block exports the following:

* `allowed_member_types` - Specifies whether this app role definition can be assigned to users and groups, or to other applications (that are accessing this application in daemon service scenarios). Possible values are: `User` and `Application`, or both.
* `description` - Permission help text that appears in the admin app assignment and consent experiences.
Expand All @@ -64,7 +64,20 @@ The following attributes are exported:

---

`oauth2_permission` block exports the following:
`oauth2_permission_scopes` block exports the following:

* `admin_consent_description` - The description of the admin consent.
* `admin_consent_display_name` - The display name of the admin consent.
* `enabled` - Is this permission enabled?
* `id` - The unique identifier for one of the `OAuth2Permission`.
* `type` - The type of the permission.
* `user_consent_description` - The description of the user consent.
* `user_consent_display_name` - The display name of the user consent.
* `value` - The name of this permission.

---

`oauth2_permissions` block exports the following:

* `admin_consent_description` - The description of the admin consent
* `admin_consent_display_name` - The display name of the admin consent
Expand Down
9 changes: 6 additions & 3 deletions docs/data-sources/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,18 @@ The following attributes are exported:
* `display_name` - The Display Name of the Azure AD User.
* `given_name` - The given name (first name) of the user.
* `id` - The Object ID of the Azure AD User.
* `immutable_id` - The value used to associate an on-premise Active Directory user account with their Azure AD user object.
* `immutable_id` - (**Deprecated**) The value used to associate an on-premise Active Directory user account with their Azure AD user object. Deprecated in favour of `onpremises_immutable_id`.
* `job_title` - The user’s job title.
* `mail_nickname` - The email alias of the Azure AD User.
* `mail_nickname` - The email alias of the Azure AD User.
* `mail` - The primary email address of the Azure AD User.
* `mobile` - The primary cellular telephone number for the user.
* `mobile` - (**Deprecated**) The primary cellular telephone number for the user. Deprecated in favour of `mobile_phone`.
* `mobile_phone` - The primary cellular telephone number for the user.
* `office_location` - The office location in the user's place of business.
* `onpremises_immutable_id` - The value used to associate an on-premise Active Directory user account with their Azure AD user object.
* `onpremises_sam_account_name` - The on-premise SAM account name of the Azure AD User.
* `onpremises_user_principal_name` - The on-premise user principal name of the Azure AD User.
* `physical_delivery_office_name` - The office location in the user's place of business.
* `physical_delivery_office_name` - (**Deprecated**) The office location in the user's place of business. Deprecated in favour of `office_location`.
* `postal_code` - The postal code for the user's postal address. The postal code is specific to the user's country/region. In the United States of America, this attribute contains the ZIP code.
* `state` - The state or province in the user's address.
* `street_address` - The street address of the user's place of business.
Expand Down
3 changes: 2 additions & 1 deletion docs/data-sources/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ ___

* `account_enabled` - `True` if the account is enabled; otherwise `False`.
* `display_name` - The Display Name of the Azure AD User.
* `immutable_id` - The value used to associate an on-premises Active Directory user account with their Azure AD user object.
* `immutable_id` - (**Deprecated**) The value used to associate an on-premises Active Directory user account with their Azure AD user object. Deprecated in favour of `onpremises_immutable_id`.
* `mail_nickname` - The email alias of the Azure AD User.
* `mail` - The primary email address of the Azure AD User.
* `object_id` - The Object ID of the Azure AD User.
* `onpremises_immutable_id` - The value used to associate an on-premises Active Directory user account with their Azure AD user object.
* `onpremises_sam_account_name` - The on-premise SAM account name of the Azure AD User.
* `onpremises_user_principal_name` - The on-premise user principal name of the Azure AD User.
* `usage_location` - The usage location of the Azure AD User.
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/azure_cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ page_title: "Authenticating via the Azure CLI"
subcategory: "Authentication"
---

# Azure Active Directory Provider: Authenticating using the Azure CLI
# Authenticating using the Azure CLI

Terraform supports a number of different methods for authenticating to Azure:

* Authenticating to Azure using the Azure CLI (covered in this guide)
* [Authenticating to Azure using Managed Service Identity](managed_service_identity.html)
* [Authenticating to Azure using Managed Identity](managed_service_identity.html)
* [Authenticating to Azure using a Service Principal and a Client Certificate](service_principal_client_certificate.html)
* [Authenticating to Azure using a Service Principal and a Client Secret](service_principal_client_secret.html)

---

We recommend using either a Service Principal or Managed Service Identity when running Terraform non-interactively (such as when running Terraform in a CI server) - and authenticating using the Azure CLI when running Terraform locally.
We recommend using either a Service Principal or Managed Identity when running Terraform non-interactively (such as when running Terraform in a CI server) - and authenticating using the Azure CLI when running Terraform locally.

## Important Notes about Authenticating using the Azure CLI

Expand Down
Loading