I want use fiddler check the https request send by Azure Powershell, but when I get the https request, it will return 403 forbidden by azure portal. Does anybody can fix this problem? Thanks very much!!!!
Yes.
It is a bit tricky, and you must be aware of the certificate used by PowerShell to communicate with Azure Management API.
There are two things you must do:
And you will be fine.
UPDATE
Fiddler v. 4.4.2.1. But the process described works with versions of Fiddler from the last 3-4 months (when I firstly tried that). And yes. I was successfully able to monitor traffic from PowerShell. Are you sure you've put not any management certificate, but the particular one that is being used by the PowerShell.
If you are using .publishsettings
file, there is very big chance that you have put a wrong certificate in your user profile folder. .publishsettings
keep base64 encoded version of the certificate, and you have to do even more exercises to get it out of there.
The cleanest approach, and one that I advocate, is to manually create your management certificate. Manually upload it to the portal and assign it to the particular subscription. Manually export the public key (.cer
file). Manually load that particular certificate in PowerShell when working with Management API. And finally manually put it into fiddler's folder. Doing so you will know which exact certificate is being used and everything will work fine.
As a sanity check, you may want to clean the .cer
certificate from My Documents\Fiddler2 folder, clean all browsers' cache (from Fiddler - clear cache), restart the PowerShell.
Now perform a clean Fiddler start (first start fiddler! before PowerShell). Then start PowerShell, configure the subscription. Perform your first action. At this moment Fiddler must ask you to put the client Certificate in the mentioned folder. Fiddler will also tell you the exact Thumbprint of certificate it needs!