Udostępnij za pośrednictwem


Azure App Service : Automate VNET Re-sync in case of failure

Use Case
Azure App Service is associated with a Virtual Network using the point-to-site connection and accessing resources which are present inside that Virtual Network. Sometimes due to x reason, the Virtual Network connection is getting disconnected and causing downtime in the application. However, the issue can be resolved by re-syncing the VNET.

Now, you want an automated way which can detect this situation and automatically perform a re-sync operation on VNET.
 

PowerShell to re-sync VNET

 

Re-sync VNET using WebJobs
To perform Sync operation on Virtual Network using WebJobs, you need a way to silently authenticate (Without any login prompt). Please follow the link below for information about silent authentication:

Once we have the Service Principal Id, Tenant Id, Subscription Id and Password values using the output of the previous step. Create a scheduled web job and Add PowerShell script which will ping the application URL and will perform VNET re-sync if there is a failure:

Note: Azure Automation Runbooks can also be used to automate this process.

/en-us/azure/automation/automation-runbook-types

Comments

  • Anonymous
    January 05, 2018
    Thanks a lot karan. Useful article.
    • Anonymous
      January 05, 2018
      Thanks.