The Analyst Agent for Microsoft 365 Copilot: Transforming How We Work
May 10, 2025Boost communication with Microsoft Copilot prompts for neuroinclusion
May 10, 2025The Yammer application platform that enabled access to legacy Viva Engage (Yammer) REST APIs via OAuth2 tokens will be officially retired on June 30, 2025. To ensure uninterrupted access, all customers must transition to using Microsoft Entra applications as soon as possible.
The good news? The legacy Yammer APIs are fully supported through modern, secure Entra apps — and getting started is easier than you might think.
This blog provides a step-by-step walkthrough for calling Yammer APIs using an Entra application with PowerShell 7, leveraging MSAL for interactive authentication. We will call /users/current.json – Yammer | Microsoft Learn API to fetch the details of the user, who completes the authentication flow.
Note:
- The examples in this post assume you have PowerShell 7 and the MSAL module pre-installed.
- If you’re looking for a Postman-based guide to access Yammer APIs, you can find detailed instructions here.
Let’s dive into how you can make this transition smoothly and start using Entra-authenticated API calls today.
Step 1: Register an Entra App
For detailed information on Entra application registration flow, refer to this guide.
- Go to Azure Portal: https://portal.azure.com
- Navigate to: Azure Active Directory → App registrations → New registration
- Fill in the form:
- Name: e.g., Yammer API Test
- Supported account types: Choose based on your org (e.g., “Accounts in this organizational directory only”)
- Select platform: Choose “Public client/native (mobile & desktop)”
- Redirect URI: Set the right redirect url, e.g., http://localhost
- Click Register
Step 2: Configure the App
Authentication
- Go to the Authentication tab
- Under Advanced settings, set:
- Allow public client flows → Yes
- Click Save
API Permissions
- Go to API permissions
- Click Add a permission
- Select Yammer
- Select Delegated → access_as_user
- Click Add permissions to save
Step 3: Run the PowerShell Script
Save the following as YammerAPI.ps1:
# Clear MSAL token cache
Clear-MsalTokenCache
# Define app credentials
$clientId = “YOUR_CLIENT_ID”
$tenantId = “YOUR_TENANT_ID”
$redirectUri = “http://localhost”
$scopes = @(” https://www.yammer.com/.default”)
# Trigger interactive login
$authResult = Get-MsalToken -ClientId $clientId -TenantId $tenantId -RedirectUri $redirectUri -Scopes $scopes -Interactive
$token = $authResult.AccessToken
# Call Yammer API
$response = Invoke-RestMethod -Method Get -Uri “https://www.yammer.com/api/v1/users/current.json” -Headers @{Authorization = “Bearer $token”}
$response
Now, replace YOUR_CLIENT_ID and YOUR_TENANT_ID with values from your app registration.
Step 4: Run the Script
In PowerShell 7:
pwsh “C:PathToYammerAPI.ps1”
You will be prompted to sign in interactively. Once authenticated, the script will call the Yammer API and return your user info.
We’re looking forward to hearing your feedback and thoughts about using the legacy Viva Engage (Yammer) APIs via modern Entra-based authentication and how you’ll use it to better manage users, conversations, and communities within Viva Engage. Stay tuned!
Aditi is a product manager at Microsoft