diff --git a/azurerm/resource_arm_api_management_authorization_server.go b/azurerm/resource_arm_api_management_authorization_server.go index 825d236670a4..d03e79282fbd 100644 --- a/azurerm/resource_arm_api_management_authorization_server.go +++ b/azurerm/resource_arm_api_management_authorization_server.go @@ -228,8 +228,6 @@ func resourceArmApiManagementAuthorizationServerCreateUpdate(d *schema.ResourceD GrantTypes: grantTypes, // Optional - AuthorizationMethods: authorizationMethods, - BearerTokenSendingMethods: bearerTokenSendingMethods, ClientAuthenticationMethod: clientAuthenticationMethods, ClientSecret: utils.String(clientSecret), DefaultScope: utils.String(defaultScope), @@ -238,10 +236,21 @@ func resourceArmApiManagementAuthorizationServerCreateUpdate(d *schema.ResourceD ResourceOwnerUsername: utils.String(resourceOwnerUsername), SupportState: utils.Bool(supportState), TokenBodyParameters: tokenBodyParameters, - TokenEndpoint: utils.String(tokenEndpoint), }, } + if len(authorizationMethodsRaw) > 0 { + params.AuthorizationServerContractProperties.AuthorizationMethods = authorizationMethods + } + + if len(bearerTokenSendingMethodsRaw) > 0 { + params.AuthorizationServerContractProperties.BearerTokenSendingMethods = bearerTokenSendingMethods + } + + if tokenEndpoint != "" { + params.AuthorizationServerContractProperties.TokenEndpoint = utils.String(tokenEndpoint) + } + if _, err := client.CreateOrUpdate(ctx, resourceGroup, serviceName, name, params, ""); err != nil { return fmt.Errorf("Error creating/updating Authorization Server %q (API Management Service %q / Resource Group %q): %+v", name, serviceName, resourceGroup, err) }