JimGBritt / AzurePolicy

Sample Azure Policies
MIT License
111 stars 56 forks source link

Update Trigger Evaluation script to make use of Invoke-AzRestMethod or Invoke-AzResourceAction #31

Open kilasuit opened 3 years ago

kilasuit commented 3 years ago

Invoke-AzRestMethod was added to the Az PowerShell some time ago and should deal with all the authentication for you Similarly I've triggered policy evaluation whilst using Invoke-AzResourceAction before Invoke-RestMethod was available.

This may help to simplify your scripts

JimGBritt commented 3 years ago

@kilasuit thanks for the feedback. Apologies I haven't had bandwidth to get back to this but it is on my list. I think the challenge here is backwards compatibility, etc. I have no idea how folks are using this in their own environments - not sure if a change of this type will actually force an update that users may not be ready to do. Granted they can opt not to move forward with a new version but I'd have to include logic to check for this cmdlet. In addition, I didn't see any value in adding it when I reviewed it previously as it seemed a zero sum scenario - the logic had to be fixed due to the breaking change in the cmdlets for REST AUTH, but when I evaluated these cmdlets at that time, there were other challenges I ran into with my scripts so I opted not to do this and keep it simple (which is probably the opposite of what you are stating :). I'm going to leave the issue open for now and see if I can get some time to do some refinement. I appreciate you adding your feedback here.