I have created cognitive services account . I want to get cognitive services account key and store it in a variable using powershell script.
I have used below script :
$resourceGroup = "Demo"
$AccountName = "DemoCs"
$Key = Get-AzCognitiveServicesAccountKey -ResourceGroupName $resourceGroup -Name $AccountName
Write-Host "account key 1 = " $Key
after executing the script result is :
2020-05-20T08:30:31Z [Information] INFORMATION: account key 1 = Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSCognitiveServicesAccountKeys
Above script is able to list keys in the cloud shell but not in powershell function app .