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

Graph: removing the AzureAD resources #5748

Merged
merged 2 commits into from
Feb 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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