-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for v2 auth tokens (i.e. MSAL)
- This is opt-in behaviour via the provider property `use_msal`, and environment variables `ARM_USE_MSAL` / `ARM_USE_MSGRAPH` (the latter for compatibility with the related backend property - When `use_msal` is true, do not make any API calls to a graph API (legacy or current). There are only 2 uses of this at present: - `data.azurerm_client_config`, which doesn't actually do anything with the result so this appears to be a vestige anyway - `azurerm_hdinsight_kafka_cluster`, the API for which requires both an AAD group ID and name to be specified (?) so currently this resource looks up the group name from the supplied ID. In future we'll require that both are specified (e.g. using `data.azuread_group` for any necessary lookup) - In v3.0, we'll remove support for graph clients in order to delegate any required usage to the AzureAD provider. - Also removes support for Azure Germany, which is now offline
- Loading branch information
1 parent
e0b8793
commit db4bce3
Showing
10 changed files
with
313 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,24 @@ | ||
package client | ||
|
||
import ( | ||
"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" | ||
"github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization" | ||
"github.com/hashicorp/terraform-provider-azurerm/internal/common" | ||
) | ||
|
||
type Client struct { | ||
GroupsClient *graphrbac.GroupsClient | ||
RoleAssignmentsClient *authorization.RoleAssignmentsClient | ||
RoleDefinitionsClient *authorization.RoleDefinitionsClient | ||
ServicePrincipalsClient *graphrbac.ServicePrincipalsClient | ||
RoleAssignmentsClient *authorization.RoleAssignmentsClient | ||
RoleDefinitionsClient *authorization.RoleDefinitionsClient | ||
} | ||
|
||
func NewClient(o *common.ClientOptions) *Client { | ||
groupsClient := graphrbac.NewGroupsClientWithBaseURI(o.GraphEndpoint, o.TenantID) | ||
o.ConfigureClient(&groupsClient.Client, o.GraphAuthorizer) | ||
|
||
roleAssignmentsClient := authorization.NewRoleAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) | ||
o.ConfigureClient(&roleAssignmentsClient.Client, o.ResourceManagerAuthorizer) | ||
|
||
roleDefinitionsClient := authorization.NewRoleDefinitionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) | ||
o.ConfigureClient(&roleDefinitionsClient.Client, o.ResourceManagerAuthorizer) | ||
|
||
servicePrincipalsClient := graphrbac.NewServicePrincipalsClientWithBaseURI(o.GraphEndpoint, o.TenantID) | ||
o.ConfigureClient(&servicePrincipalsClient.Client, o.GraphAuthorizer) | ||
|
||
return &Client{ | ||
GroupsClient: &groupsClient, | ||
RoleAssignmentsClient: &roleAssignmentsClient, | ||
RoleDefinitionsClient: &roleDefinitionsClient, | ||
ServicePrincipalsClient: &servicePrincipalsClient, | ||
RoleAssignmentsClient: &roleAssignmentsClient, | ||
RoleDefinitionsClient: &roleDefinitionsClient, | ||
} | ||
} |
Oops, something went wrong.