Welcome › Forums › General PowerShell Q&A › Error while setting alert conditions for azure budget via powershell
I am writing a script to set azure consumption budget and notification alert to subscription owner.
Everything is working fine except setting up an action group.
Below is the command i am using
set-azurermconsumptionbudget -name Azureconsumption -notificationkey actual_greaterthan_80_percent -contactgroup ‘Budget- 2019’ -contactemail [email protected],[email protected]
Set-AzureRmConsumptionBudget : Operation returned an invalid status code ‘Unauthorized’
At line:1 char:1
Can any one tell me the proper format or the solution to this?
Have you tried something like this?
Set-AzureRmConsumptionBudget -Name Azureconsumption -NotificationKey actual_greaterthan_80_percent -NotificationEnabled -NotificationThreshold 90 -ContactEmail [email protected],[email protected] -ContactRole Owner,Reader,Contributor
I am still getting the “unauthorized” error