Skip to content

Commit

Permalink
Merge pull request #5748 from terraform-providers/f/removing-azuread
Browse files Browse the repository at this point in the history
Graph: removing the AzureAD resources
  • Loading branch information
tombuildsstuff authored Feb 14, 2020
2 parents a47f09d + d1a6bf4 commit 504179e
Show file tree
Hide file tree
Showing 23 changed files with 14 additions and 2,151 deletions.
3 changes: 0 additions & 3 deletions azurerm/internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
eventgrid "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/eventgrid/client"
eventhub "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/eventhub/client"
frontdoor "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/frontdoor/client"
graph "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/graph/client"
hdinsight "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/hdinsight/client"
healthcare "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/healthcare/client"
iothub "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/iothub/client"
Expand Down Expand Up @@ -96,7 +95,6 @@ type Client struct {
EventGrid *eventgrid.Client
Eventhub *eventhub.Client
Frontdoor *frontdoor.Client
Graph *graph.Client
HDInsight *hdinsight.Client
HealthCare *healthcare.Client
IoTHub *iothub.Client
Expand Down Expand Up @@ -164,7 +162,6 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
client.EventGrid = eventgrid.NewClient(o)
client.Eventhub = eventhub.NewClient(o)
client.Frontdoor = frontdoor.NewClient(o)
client.Graph = graph.NewClient(o)
client.HDInsight = hdinsight.NewClient(o)
client.HealthCare = healthcare.NewClient(o)
client.IoTHub = iothub.NewClient(o)
Expand Down
2 changes: 0 additions & 2 deletions azurerm/internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/eventgrid"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/eventhub"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/frontdoor"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/graph"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/hdinsight"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/healthcare"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/iothub"
Expand Down Expand Up @@ -88,7 +87,6 @@ func SupportedServices() []common.ServiceRegistration {
eventgrid.Registration{},
eventhub.Registration{},
frontdoor.Registration{},
graph.Registration{},
hdinsight.Registration{},
healthcare.Registration{},
iothub.Registration{},
Expand Down
14 changes: 10 additions & 4 deletions azurerm/internal/services/authorization/client/client.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
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/2018-09-01-preview/authorization"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common"
)

type Client struct {
RoleAssignmentsClient *authorization.RoleAssignmentsClient
RoleDefinitionsClient *authorization.RoleDefinitionsClient
RoleAssignmentsClient *authorization.RoleAssignmentsClient
RoleDefinitionsClient *authorization.RoleDefinitionsClient
ServicePrincipalsClient *graphrbac.ServicePrincipalsClient
}

func NewClient(o *common.ClientOptions) *Client {
Expand All @@ -17,8 +19,12 @@ func NewClient(o *common.ClientOptions) *Client {
roleDefinitionsClient := authorization.NewRoleDefinitionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&roleDefinitionsClient.Client, o.ResourceManagerAuthorizer)

servicePrincipalsClient := graphrbac.NewServicePrincipalsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&servicePrincipalsClient.Client, o.ResourceManagerAuthorizer)

return &Client{
RoleAssignmentsClient: &roleAssignmentsClient,
RoleDefinitionsClient: &roleDefinitionsClient,
RoleAssignmentsClient: &roleAssignmentsClient,
RoleDefinitionsClient: &roleDefinitionsClient,
ServicePrincipalsClient: &servicePrincipalsClient,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func dataSourceArmClientConfigRead(d *schema.ResourceData, meta interface{}) err

var servicePrincipal *graphrbac.ServicePrincipal
if client.Account.AuthenticatedAsAServicePrincipal {
spClient := client.Graph.ServicePrincipalsClient
spClient := client.Authorization.ServicePrincipalsClient
// Application & Service Principal is 1:1 per tenant. Since we know the appId (client_id)
// here, we can query for the Service Principal whose appId matches.
filter := fmt.Sprintf("appId eq '%s'", client.Account.ClientId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ data "azurerm_batch_account" "test" {

func testAccDataSourceAzureBatchAccount_userSubscription(data acceptance.TestData, tenantID string, subscriptionID string) string {
return fmt.Sprintf(`
data "azurerm_azuread_service_principal" "test" {
data "azuread_service_principal" "test" {
display_name = "Microsoft Azure Batch"
}
Expand All @@ -154,7 +154,7 @@ resource "azurerm_key_vault" "test" {
access_policy {
tenant_id = "%s"
object_id = "${data.azurerm_azuread_service_principal.test.object_id}"
object_id = "${data.azuread_service_principal.test.object_id}"
secret_permissions = [
"get",
Expand All @@ -169,7 +169,7 @@ resource "azurerm_key_vault" "test" {
resource "azurerm_role_assignment" "contribrole" {
scope = "/subscriptions/%s"
role_definition_name = "Contributor"
principal_id = "${data.azurerm_azuread_service_principal.test.object_id}"
principal_id = "${data.azuread_service_principal.test.object_id}"
}
resource "azurerm_batch_account" "test" {
Expand Down
24 changes: 0 additions & 24 deletions azurerm/internal/services/graph/client/client.go

This file was deleted.

150 changes: 0 additions & 150 deletions azurerm/internal/services/graph/data_source_azuread_application.go

This file was deleted.

Loading

0 comments on commit 504179e

Please sign in to comment.