---
title: "Azure VM Scale Sets"
description: "Basic example of nginx deployed in Azure VM Scale Sets written in Python"
url: "https://www.pulumi.com/dev/examples/classic-azure-py-vm-scaleset/"
image: "https://www.pulumi.com/assets/og/dev/examples/classic-azure-py-vm-scaleset.png"
---

# Azure VM Scale Sets

Basic example of nginx deployed in Azure VM Scale Sets written in Python

- Source on GitHub: https://github.com/pulumi/examples/tree/master/classic-azure-py-vm-scaleset
- Deploy with Pulumi: https://app.pulumi.com/new?template=https%3A%2F%2Fgithub.com%2Fpulumi%2Fexamples%2Ftree%2Fmaster%2Fclassic-azure-py-vm-scaleset

## Get started with this example

This example lives in the [pulumi/examples](https://github.com/pulumi/examples/tree/master/classic-azure-py-vm-scaleset) repo. Pull down just this directory to follow along:

```bash
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set classic-azure-py-vm-scaleset
cd pulumi-examples/classic-azure-py-vm-scaleset
```

This example provisions a Scale Set of Linux web servers with nginx deployed, configured the auto-scaling based on CPU load, puts a Load Balancer in front of them, and gives it a public IP address.

## Prerequisites

1. [Install Pulumi](https://www.pulumi.com/docs/get-started/install/)
1. [Configure Pulumi for Azure](https://www.pulumi.com/docs/intro/cloud-providers/azure/setup/)
1. [Configure Pulumi for Python](https://www.pulumi.com/docs/intro/languages/python/)

## Running the App

1. Create a new stack:

    ```bash
    pulumi stack init dev
    ```

1. Configure the app deployment.

    ```bash
    pulumi config set azure:location westus    # any valid Azure region will do
    pulumi config set azure:subscriptionId <YOUR_SUBSCRIPTION_ID>
    ```

    Optionally, configure the username and password for the admin user. Otherwise, they will be auto-generated.

    ```bash
    pulumi config set adminUser webmaster
    pulumi config set adminPassword <your-password> --secret
    ```

    Note that `--secret` ensures your password is encrypted safely.

1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

    ```bash
    az login
    ```

1. Run `pulumi up` to preview and deploy changes:

    ```console
    $ pulumi up
    Previewing update:
    ...

    Updating:
    ...
    Resources:
        13 created
    Update duration: 2m19s
    ```

1. Check the domain name of the PIP:

    ```console
    $ pulumi stack output publicAddress
    dsuv3vqbgi.westeurope.cloudapp.azure.com
    $ curl http://$(pulumi stack output publicAddress)
    #nginx welcome screen HTML is returned
    ```
