Here is a quick PowerShell script to execute commands in SCM website on all instances.
For example, lets say you have a website running in an App Service Plan that has more than one instance and you would like to delete log files form all instances. You can log into KUDU console at
<your website name>.scm.AzureWebsites.net
Debug Console | CMD
to delete log files. By default, KUDU console is connected to one of random instance. If you like to connect to another instance, you can follow these
Another option is you can use below PowerShell scripts that will execute a CMD command on all instances :