Hello,
I'm trying to obtain an access token for Azure Video Indexer using PowerShell. Here is what I've done so far:
Created a Video Indexer account:
- Subscription ID:
06a3bdd8-f407-4903-9161-f7101c66d9e1
- Account ID:
ade73671-7aa2-4a99-9081-f554a1ca917a
$subscriptionKey = "b6af2f193c394a6abee013d8399d46b4" # Primary subscription key
$location = "trial" # The location of your Video Indexer account, use "trial" if it's a trial account
$accountId = "ade73671-7aa2-4a99-9081-f554a1ca917a" # Your Video Indexer account ID
Function to get an access token
function Get-AccessToken {
param (
[string]$subscriptionKey,
[string]$location,
[string]$accountId
)
$uri = "https://api.videoindexer.ai/Auth/$location/Accounts/$accountId/AccessToken?allowEdit=true"
$headers = @{
"Ocp-Apim-Subscription-Key" = $subscriptionKey
}
$response = Invoke-RestMethod -Method Get -Uri $uri -Headers $headers
return $response
```}
# Get the access token
$accessToken = Get-AccessToken -subscriptionKey $subscriptionKey -location $location -accountId $accountId
Write-Output "Access Token: $accessToken"
```
**Error Message**:
```json
plaintextCopy code
{
"ErrorType": "USER_NOT_ALLOWED",
"Message": "User has no permission on account"
```