-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements to Service Principals and some other bug fixes
**Service Principals** - Support the `account_enabled` field - Support the `alternative_names` field - Support the `description` field - Support the `login_url` field - Support the `notes` field - Support the `notification_email_addresses` field - Support the `preferred_single_sign_on_mode` field - Support the `use_existing` field - Export the `application_tenant_id` attribute - Export the `display_name` attribute - Export the `homepage_url` attribute - Export the `logout_url` attribute - Export the `redirect_uris` attribute - Export the `saml_metadata_url` attribute - Export the `service_principal_names` attribute - Export the `sign_in_audience` attribute - Export the `type` attribute **Applications** - New data source: `azuread_application_published_app_ids` **Bug fixes** - `azuread_application` - `identifier_uris` is now a TypeSet (was TypeList) **Breaking Change** - `azuread_application` - fix a bug parsing the `implicit_grant` block
- Loading branch information
1 parent
3e5eed1
commit 64a98a4
Showing
23 changed files
with
668 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
subcategory: "Applications" | ||
--- | ||
|
||
# Data Source: azuread_application_published_app_ids | ||
|
||
Use this data source to discover application IDs for APIs published by Microsoft. | ||
|
||
This data source uses an [unofficial source of application IDs](https://github.com/manicminer/hamilton/blob/main/environments/published.go), as there is currently no available official indexed source for applications or APIs published by Microsoft. | ||
|
||
The app IDs returned by this data source are sourced from the Azure Global (Public) Cloud, however some of them are known to work in government and national clouds. | ||
|
||
## Example Usage | ||
|
||
*Listing well-known application IDs* | ||
|
||
```terraform | ||
data "azuread_application_published_app_ids" "well_known" {} | ||
output "published_app_ids" { | ||
value = data.azuread_application_published_app_ids.well_known.result | ||
} | ||
``` | ||
|
||
*Granting access to an application* | ||
|
||
```terraform | ||
data "azuread_application_published_app_ids" "well_known" {} | ||
resource "azuread_service_principal" "msgraph" { | ||
application_id = data.azuread_application_published_app_ids.well_known.result.MicrosoftGraph | ||
use_existing = true | ||
} | ||
resource "azuread_application" "example" { | ||
display_name = "example" | ||
required_resource_access { | ||
resource_app_id = data.azuread_application_published_app_ids.well_known.result.MicrosoftGraph | ||
resource_access { | ||
id = azuread_service_principal.msgraph.app_role_ids["User.Read.All"] | ||
type = "Role" | ||
} | ||
resource_access { | ||
id = azuread_service_principal.msgraph.oauth2_permission_scope_ids["User.ReadWrite"] | ||
type = "Scope" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
This data source does not have any arguments. | ||
|
||
## Attributes Reference | ||
|
||
The following attributes are exported: | ||
|
||
* `result` - A map of application names to application IDs. |
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
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
37 changes: 37 additions & 0 deletions
37
internal/services/applications/application_published_app_ids_data_source.go
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package applications | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/manicminer/hamilton/environments" | ||
|
||
"github.com/hashicorp/terraform-provider-azuread/internal/tf" | ||
) | ||
|
||
func applicationPublishedAppIdsDataSource() *schema.Resource { | ||
return &schema.Resource{ | ||
ReadContext: func(_ context.Context, d *schema.ResourceData, _ interface{}) diag.Diagnostics { | ||
tf.Set(d, "result", environments.PublishedApis) | ||
d.SetId("appIds") | ||
return nil | ||
}, | ||
|
||
Timeouts: &schema.ResourceTimeout{ | ||
Read: schema.DefaultTimeout(5 * time.Minute), | ||
}, | ||
|
||
Schema: map[string]*schema.Schema{ | ||
"result": { | ||
Description: "A mapping of application names and application IDs", | ||
Type: schema.TypeMap, | ||
Computed: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
}, | ||
}, | ||
}, | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
internal/services/applications/application_published_app_ids_data_source_test.go
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package applications_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/hashicorp/terraform-provider-azuread/internal/acceptance" | ||
"github.com/hashicorp/terraform-provider-azuread/internal/acceptance/check" | ||
) | ||
|
||
type ApplicationPublishedAppIdsDataSource struct{} | ||
|
||
func TestAccApplicationPublishedAppIdsDataSource_basic(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "data.azuread_application_published_app_ids", "test") | ||
r := ApplicationPublishedAppIdsDataSource{} | ||
|
||
data.DataSourceTest(t, []resource.TestStep{ | ||
{ | ||
Config: r.basic(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).Key("result.%").Exists(), | ||
), | ||
}, | ||
}) | ||
} | ||
|
||
func (ApplicationPublishedAppIdsDataSource) basic(data acceptance.TestData) string { | ||
return `provider azuread {} | ||
data "azuread_application_published_app_ids" "test" {}` | ||
} |
Oops, something went wrong.