How to get Techlatest Stable Diffusion with AUTOMATIC1111 Web Interface on AZURE

This section describes how to launch and connect to Techlatest Stable Diffusion with AUTOMATIC1111 Web Interface on Azure.

Note: Stable diffusion requires a lot of processing, so a GPU instance is recommended. If you want to use a CPU instance due to the high price of GPU instances, you should use instances with a higher CPU.
Again note that GPU's are not available in some zones and for some instance types.

Below are recommended VM configuration requirements:

  • GPU VM : Standard_NC4as_T4_v3 (4 vcpu 28GB memory) configuration
  • CPU VM : Standard_B4ms (4vcpu, 16gb ram)
  • For CPU, its the minimum spec but more cpu is preferred.



Note: GPU instance will perform 10x or more faster when processing request compared to CPU instance . Typical GPU instance will take 1-2 minutes to render images compared to 10-20 minutes by CPU instance, hence GPU instances are preferred.

  1. Open Techlatest Stable Diffusion with AUTOMATIC1111 UI VM listing on Azure Marketplace

  2. /img/azure/stable-diffusion/marketplace.png

  3. Click on Get It Now
    • Select a Resource group for your virtual machine
    • Select a Region where you want to launch the VM(such as East US)

    • /img/azure/stable-diffusion/basics-page-01.png

    • Optionally change the number of cores and amount of memory.
    • Select the Authentication type as Password and enter Username as ubuntu and Password of your choice.
    • /img/azure/stable-diffusion/basics-page-02.png

    • Optionally change the OS disk type.

    • /img/azure/stable-diffusion/disk.png

    • Optionally change the network and subnetwork names.Be sure that whichever network you specify has ports 22 (for ssh), 3389 (for RDP) and 80 (for HTTP) exposed.

    • /img/azure/stable-diffusion/network.png

    • Optionally go to the Management, Advanced and Tags tabs for any advance settings you want for the VM.
    • Click on Review + create and then click on Create when you are done.
      Virtual Machine will begin deploying.

  1. A summary page displays when the virtual machine is successfully created. Click on Go to resource link to go to the resource page. It will open an overview page of virtual machine.

  2. /img/azure/stable-diffusion/vm-overview.png

  3. In the left navigation pane, select Run command , select RunShellScript and enter following command to change the password of the vm .

    sudo echo ubuntu:yourpassword | chpasswd

  4. /img/azure/run_command_option-01.png


  5. Now the password for ubuntu user is set, you can connect to the VM's desktop environment from any local windows machine using RDP protocol or local linux machine using Remmina.

  6. To connect using RDP via Windows Machine, first note the public IP address of the VM from VM details page as highlighted below

  7. /img/azure/stable-diffusion/public-ip.png

  8. Then From you local windows machine, goto "start" menu , in the search box type and select "Remote desktop connection".
    In the "Remote Desktop connection" wizard, copy the public IP address and click connect

  9. /img/azure/desktop-linux/rdp.png

  10. This will connect you to the VM's desktop environment. Provide the username (e.g "ubuntu") and the password set in the step4 to authenticate. Click OK

  11. /img/azure/stable-diffusion/rdp-login.png

  12. Now you are connected to the out of box Techlatest Stable Diffusion with AUTOMATIC1111 UI environment via Windows Machine.

  13. /img/azure/stable-diffusion/rdp-desktop.png

  14. To connect using RDP via Linux machine, first note the external IP of the VM from VM details page,then from your local Linux machine, goto menu , in the search box type and select "Remmina".

    Note: If you don't have Remmina installed on your Linux machine, first Install Remmina as per your linux distribution.

  15. /img/gcp/common/remmina-search.png

  16. In the "Remmina Remote Desktop Client" wizard, select the RDP option from dropdown and paste the external ip and click enter.

  17. /img/gcp/common/remmina-external-ip.png

  18. This will connect you to the VM's desktop environment. Provide "ubuntu" as the userid and the password set in above reset password step to authenticate. Click OK

  19. /img/gcp/common/remmina-rdp-login.png

  20. Now you are connected to out of box Techlatest Stable Diffusion with AUTOMATIC1111 UI environment via Linux machine.

  21. /img/azure/stable-diffusion/rdp-desktop.png

  1. To SSH to the VM, Open putty and paste the IP address and click on Open.

  2. /img/aws/ethereum-fullnode/putty-01.png

  3. login as ubuntu and provide the password for 'ubuntu' user

  4. /img/azure/stable-diffusion/ssh.png

  5. To access the Stable Diffusion GUI via browser, Copy the public IP of the vm in the browser and hit enter.
  6. Note: Please use http and not https in the URL.
    Please Note that for the first time, it will take 2-3 minutes to launch the app in the browser. So if GUI is not coming please try after few minutes.
    Note: CPU instances take time to launch the Web UI. To verify if Stable Diffusion Web UI is launched, Please run below command in the terminal.


    If the output returns curl: (7) Failed to connect to port 7860: Connection refused as shown below , then keep running above curl command till html output is found.


    If this command returns html data as shown below, then Web UI is up and running. You can access it in browser using http://public_ip_of_vm



  7. The Stable Diffusion GUI comes with lots of options and settings. The first window shows text to image page. Provide the Prompt and click on Generate button and wait till it finishes.

  8. /img/azure/stable-diffusion/stable-diffusion-gui.png

  9. Output Images can be seen in the Image Browser tab. Click on Image browser and click on first page to load the images.

  10. /img/azure/stable-diffusion/image-browser-gallery.png

  11. In Image Browser, click on any image to see the details of it.

  12. /img/azure/stable-diffusion/image-browser.png

  13. To change any settings, go to Settings tab.

  14. /img/azure/stable-diffusion/settings.png

  15. Web UI also provides you the option to add extensions. Navigate to extensions tab, go to available and select load from URL. It will list all the available extensions.

  16. /img/azure/stable-diffusion/extensions.png

  17. For more information on how to use the GUI, Go to Stable Diffusion Web UI
  18. The images created from GUI are stored under /home/ubuntu/stable-diffusion/output directory.
    To access this directory, connect to VM's Desktop environment as explained above, and navigate to home -> ubuntu -> stable-diffusion -> output directory.

  19. /img/gcp/stable-diffusion/output-directory.png

  20. You can also access the sourcecode of the Stable Diffusion. It is available under sourcecode folder on Desktop.

  21. /img/gcp/stable-diffusion/source-code-folder-on-desktop.png