How can I remotely update my azure webapp firewall with my local PCs IP address for administration either via powershell or C#.
I have had a look over the documentation but I can only find out how to do it from the actual server itself, not remotely.
I can get visual studio to pop up and ask me if I want to add my IP address to the firewall randomly, but most the time it simply fails and does not ask me so I am looking for a solution other than manually logging into the azure portal whenever my IP address changes.
Looking for either an example or a link to documentation that shows which libraries to use.
Update: I tried Tom Suns answer however we are using a web app not an sql server so it does not work.
azure.WebApps.GetByResourceGroup("resourcegroup","webapp")
returns the web app but I cannot find anyway to programatically access the "Access Restrictions" found under networking for this web app.
I also can only access the main deployment slot for this web app. I need to set the firewall individually per deployment slot (as can be done via the azure web interface).
I have tried accessing the second deployment slot via the following names, all return null. This is assuming the web app is named 'webapp' and the deployment slot is named 'slo1'
webapp-slot1 webapp_slot1 webapp/slot1
I have also tried GetByID instead of GetByResourceGroup however I cannot find any examples of what he ID is and where it can be found. I've tried almost every single ID I can find on the azure web UI.
Finally Tom Sun's answer requires hard coded credentials being stored on a drive. This is far from optimal. I would prefer a popup UI that prompts the user for their username and password, this used to be possible with older versions of the API however everything I can find says it is no longer. I may have to resort to powershell.