Skip to content
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
43 changes: 43 additions & 0 deletions samples/9-Applications.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,49 @@ $app3 = New-MgApplication -displayName "ImplicitWebApp" `
} `
}

# Create an registration for an ASP.NET Web App
$app = New-MgApplication -displayName "AspNetWebApp" `
-Web @{
RedirectUris = "https://localhost:5001/signin-oidc"; `
ImplicitGrantSettings = @{
EnableIdTokenIssuance = $true
}
}`
-RequiredResourceAccess @{ ResourceAppId = "00000003-0000-0000-c000-000000000000"
ResourceAccess = @(
@{
Id = "e1fe6dd8-ba31-4d61-89e7-88639da4683d"
Type = "Scope"
}
)
}

## Create a registration for an ASP.NET Web App that call the Graph
$web = @{
RedirectUris = @("https://localhost:5001/signin-oidc", "https://localhost:5001/" )
LogoutUrl = "https://localhost:5001/signout-oidc"
ImplicitGrantSettings = @{ EnableIdTokenIssuance = $true }
}

$createAppParams = @{
DisplayName = "AspNetWebApp6"
Web = $web
RequiredResourceAccess = @{
ResourceAppId = "00000003-0000-0000-c000-000000000000"
ResourceAccess = @(
@{
Id = "e1fe6dd8-ba31-4d61-89e7-88639da4683d"
Type = "Scope"
}
)
}
}
# note the use of @ below, instead of the expected $
$app = New-MgApplication @createAppParams

$secret = Add-MgApplicationPassword -applicationId $app.Id


# Create an application for use with Confidential Client flow using a certificate.
# Get certificate from current user store.
$CertificateThumbprint = "YOUR_THUMBPRINT"
Expand Down
18 changes: 18 additions & 0 deletions samples/A-Mail.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Send a mail

$Message = @{
"subject" = "Yo"
"body" = @{
"content" = "Here is my message"
}
"toRecipients" = @(
@{
"emailAddress" = @{
"address" = "user@example.com"
}
}
)
}

Send-MgUserMail -userId sender@domain.org -Message $Message