Below is a sample script you can use to utilize the REST API for azure:

  
$tenantid = "<tenand-id-here>"
  
function GetAuthToken
  
{
         
param
         
(
                
[Parameter(Mandatory=$true)]
                
$TenantName
         
)
         
$adal = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
         
$adalforms = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"
         
[System.Reflection.Assembly]::LoadFrom($adal) | Out-Null
         
[System.Reflection.Assembly]::LoadFrom($adalforms) | Out-Null
         
$clientId = "1950a258-227b-4e31-a9cf-717495945fc2"
         
$redirectUri = "urn:ietf:wg:oauth:2.0:oob"
         
$resourceAppIdURI = "https://management.azure.com/"
         
$authority = "https://login.windows.net/$TenantName"
         
$authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority
         
$authResult = $authContext.AcquireToken($resourceAppIdURI, $clientId,$redirectUri, "Auto")

return $authResult
  
}
  
$token = GetAuthToken -TenantName $tenantid
  
$authHeader = @{
     
'Content-Type'='application\json'
     
'Authorization'=$token.CreateAuthorizationHeader()
  
}
  

You can then use the obtained token from above to utilize the API. This is passed in the header of the request:

  
$uri = "https://management.azure.com/subscriptions/$($subscriptionid)/resourceGroups/$($RGname)/providers/Microsoft.servicebus/Namespaces/$($namespace)/topics/?api-version=2015-08-01"
  
$tenantInfo = (Invoke-RestMethod -Uri $uri Headers $authHeader Method Get Verbose)
  
$tenantinfo
  

To find what operations are available:

  
$uri = "https://management.azure.com/providers/Microsoft.servicebus/operations?api-version=2015-08-01"
  

Will post in the future an update here with more functionality, and real-world use-case.