---
title: "Azure WebServer with Manual Provisioning"
description: "An example of an Azure VM webserver instance with post-provision configuration."
url: "https://www.pulumi.com/dev/examples/classic-azure-ts-vm-provisioners/"
image: "https://www.pulumi.com/assets/og/dev/examples/classic-azure-ts-vm-provisioners.png"
---

# Azure WebServer with Manual Provisioning

An example of an Azure VM webserver instance with post-provision configuration.

- Source on GitHub: https://github.com/pulumi/examples/tree/master/classic-azure-ts-vm-provisioners

## Get started with this example

This example lives in the [pulumi/examples](https://github.com/pulumi/examples/tree/master/classic-azure-ts-vm-provisioners) 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-ts-vm-provisioners
cd pulumi-examples/classic-azure-ts-vm-provisioners
```

This demonstrates using the [`@pulumi/command`](https://www.pulumi.com/registry/packages/command/) package to accomplish post-provisioning configuration steps.

Using these building blocks, one can accomplish much of the same as Terraform provisioners.

## Running the Example

First, create a stack, using `pulumi stack init`.

Now, we need to ensure that our dependencies are installed:

```bash
npm install
```

You'll need to log in to the azure cli. You will be prompted to do this during deployment if you forget this step.

```bash
az login
```

We'll need to set some config for login credentials, and location information.

```bash
pulumi config set azure:location westus
pulumi config set azure:subscriptionId <YOUR_SUBSCRIPTION_ID>
pulumi config set username <your_username>
pulumi config set password --secret <your_desired_password>
```

Next, generate an OpenSSH keypair for use with your server - as per the Azure [Requirements][1]

```bash
ssh-keygen -t rsa -f rsa -m PEM
```

This will output two files, `rsa` and `rsa.pub`, in the current directory. Be sure not to commit these files!

We then need to configure our stack so that the public key is used by our VM, and the private key used
for subsequent SCP and SSH steps to configure our server after it is stood up.

```bash
cat rsa.pub | pulumi config set publicKey --
cat rsa | pulumi config set privateKey --secret --
```

Notice that we've used `--secret` for `privateKey`. This ensures the private key is stored as an encrypted [Pulumi secret](https://www.pulumi.com/docs/intro/concepts/secrets/).

From there, you can run `pulumi up` and all resources will be provisioned and configured.

[1]: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ssh-from-windows#create-an-ssh-key-pair
