microsoftgraph / microsoftgraph/msgraph-sdk-powershell
Additional examples for creating a new application: New-MgApplication
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 898
- Forks
- 230
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 31
Description
Is your feature request related to a problem? Please describe the problem.
Some of the documentation lacks clarity and could use additional examples. For instance, the New-MgApplication documentation page contains one example but accepts close to 55 parameters. While it's impractical to add an example for each one of them, the documentation could use a couple of more examples. The notes section shows what properties each of them should contain so to expand on a couple of them and demonstrate would be helpful
Describe the solution you'd like.
The documentation could be updated with the following examples:
Example 1: Create a new application with web settings
New-MgApplication -DisplayName "New app" -Web @{
ImplicitGrantSettings = @{
EnableAccessTokenIssuance = $true
EnableIdTokenIssuance = $true
}
RedirectUris = "http://localhost.com"
}
The above example creates a new application with both access tokens and Id tokens to be issued. Additionally, it also sets the redirect uri for the app registration to redirect to after successful authentication
Example 2: Create a new application with access to specified resources
Step1: Create a JSON representation of the required resources
$RequiredResource= @'[
{
"ResourceAppId": "00000003-0000-0000-c000-000000000000",
"ResourceAccess": [
{
"Id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"Type": "Scope"
},
{
"Id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"Type": "Role"
}
]
},
{
"ResourceAppId": "00000002-0000-0000-c000-000000000000",
"ResourceAccess": [
{
"Id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"Type": "Scope"
}
]
}
]'@
Step 2: Read the JSON object
$RequiredResourceAccess = @(
$RequiredResource | ForEach-Object {
@{
ResourceAppId = $_.ResourceAppId
ResourceAccess = @(
$_.ResourceAccess | ForEach-Object {
@{
Id = $_.Id
Type = $_.Type
}
}
)
}
})
Step 3: Create the application
New-MgApplication -DisplayName $AppRegistrationName -RequiredResourceAccess $RequiredResourceAccess
The above example allows for creation of an app registration with access to several required resources and permissions
Additional context?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the New-MgApplication documentation page and its existing example and notes section. Add the two proposed examples for web settings and required resource access, with their explanations; the work is done when the page demonstrates these parameter combinations clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100