This scenario demonstrates how you can use Azure Managed Identity to return a list of Office 365 Groups from the Microsoft Graph without needing to pass any credentials.
The deployment script will automatically enable managed identity and create a system assigned identity.
This scenario requires
- Active Azure Subscription
- PowerShell
- Azure CLI v2.8.0
- Office 365 CLI v2.11.0
Active login to Azure CLI & Office 365 CLI is assumed
- Open PowerShell prompt
- Execute
.\deploy.ps1
to deploy Azure resources
- Connect to Office 365 tenant using Office 365 CLI using
m365 login
command - Execute
m365 aad approleassignment add --displayName "la-keylessauth-dev" --resource "Microsoft Graph" --scope "Group.Read.All"
to assign the Microsoft GraphGroup.Read.All
application role to the Managed Identity service principal
- Go to
la-keylessauth-dev
blade - Click
Recurence
on theLogic Apps Designer
blade - Click
New step
and selectHTTP
action - Choose
GET
in method dropdown - Set the URI to
https://graph.microsoft.com/v1.0/groups
- Add Headers key
accepts
with the valueapplication/json
- Click
Add new parameter
dropdown and checkAuthentication
box, click off to reveal theAuthentication
section - Select
Managed Identity
inAuthentication type
dropdown - Select
System Assigned Managed Identity
- Add
https://graph.microsoft.com
toAudience
field - Click
Save
andRun