Azure App Service: How to connect to the Kudu site of a specific instance
Every Azure Web App has an associated ‘scm’ service site, which runs Kudu and other
OVERVIEW:
-
Kudu site can be accessed using either of these credentials
-
Single Sign-on
-
User-level credentials (aka Deployment Credentials)
-
Site-level credentials (aka Publish Profile Credentials)
</ul>
-
Kudu site always connect to a single instance. E.g. If the site is hosted in an App Service plan which is scaled out to 3 instances, then at any time the KUDU will always connect to one instance only.
</ul> Here is a simple request flow of an Azure Web App
this on how disable ARR Affinity.
The ARRAffinity cookie is unique and corresponds to an instance. If there are multiple instances, then there will be ARRAffinity cookie corresponding to those many instances. So we can modify the ARRAffinity cookie in the HTTP response and force KUDU to connect to a specific instance.PRE-REQUISITES:-
Browser: Chrome/Firefox/Opera or any other browser which has extensions that allows you to edit cookies.
-
Extension: EditThisCookie (Chrome) | EditThisCookie (Opera)
</ul> DETERMINE THE ARRAFFINITY COOKIE OF AN INSTANCE
-
Browse to
https://resources.azure.com/ (Azure Resource Explorer)
-
In the search window enter the name of the web app. See the following screenshot for reference:
</ul>
-
If there are other Azure resources with similar names, select the resource of type “Microsoft.Web/sites”
-
In the left side panel, expand “instances” and this would load all the instances on which the web app is hosted. The instance name displayed is also the value of the ARRAffinity cookie.
</ul>
-
bac64d
-
c2a879
</ol> CONNECT TO THE KUDU CONSOLE OF A SPECIFIC INSTANCE
-
For this we need to have a tool which allows us to modify the cookies
-
There are multiple ways to do this.
-
I am using EditThisCookie extension in chrome browser. Here is the link to install this:
-
Now, browse to the KUDU site of your web app:
[https://
.scm.azurewebsites.net</font>](https://%3csitename%3e.scm.azurewebsites.net) (replace with name of the web app</i>) </font> -
Click on Environment.
-
Under System info, the “instance id” value determines the instance to which the KUDU is connected. In the screenshot below, the kudu site is connected to the instance whose short instance id is bac64d.
</ul>
-
We can use one of the instances value we obtained via ARM explorer to force KUDU to connect to a specific site.
(Here we are connecting to the instance with the id beginning with “bac64d” )-
In the browser window click on EditThisCookie icon (next to the Address bar).
</ul>
- In the pop-up, click on ARRAffinity
- Replace the value with the instance id that you need to connect to
- Click on the tick mark to save the cookie and then refresh the page.
-
In the browser window click on EditThisCookie icon (next to the Address bar).
-
Under System info, the “instance id” value determines the instance to which the KUDU is connected. In the screenshot below, the kudu site is connected to the instance whose short instance id is bac64d.
-
Click on Environment.
-
Now, browse to the KUDU site of your web app:
-
I am using EditThisCookie extension in chrome browser. Here is the link to install this:
-
There are multiple ways to do this.
-
c2a879
-
In the left side panel, expand “instances” and this would load all the instances on which the web app is hosted. The instance name displayed is also the value of the ARRAffinity cookie.
-
In the search window enter the name of the web app. See the following screenshot for reference:
-
Extension: EditThisCookie (Chrome) | EditThisCookie (Opera)
-
Site-level credentials (aka Publish Profile Credentials)
-
User-level credentials (aka Deployment Credentials)
-
Single Sign-on