All,
I trying to get a diagnostic setting from within an azure pipeline with the YAML :
steps:
- task: AzureCLI@2
displayName: Ammend Diagnostic Settings
inputs:
azureSubscription: ${{ parameters.environmentServiceConnection }}
scriptLocation: inlineScript
ScriptType: ps
inlineScript: |
#$Diago = Get-AzDiagnosticSetting -ResourceId ""
If I executed the Get-DiagnosticSetting command with my normal 'admin' account I can see the diagnostic settings fine.. I am using an SPN for the pipeline and I get the error :
Get-AzDiagnosticSetting : Exception type: ErrorResponseException, Message:
Microsoft.Azure.Management.Monitor.Models.ErrorResponseException: Operation returned an invalid status code 'Forbidden'
So it is something to do with my permissions on my SPN - but I have no idea where the permission would be where I need to check (in Azure) to make sure i can get this to work.
Any help would be brilliant.
CodePudding user response: