In this article, I will be going through the steps for setting up Pulumi and creating your own infrastructure using Azure as our cloud provider. By the end of this article, you should be able to set up and authenticate Pulumi with Azure and have created an Azure resource for a Function app.
Download and install Pulumi. Depending on your environment, you should use any of these commands:
Windows
choco install pulumi
MacOS
brew install pulumi
Linux
curl -fsSL https://get.pulumi.com | sh
Pulumi authenticates with Azure in two ways.
For the sake of this tutorial, we will use the Azure CLI login. However, if you’re ever running Pulumi in production and need to manage your infrastructure resources in your build or release pipeline, you would use the service principal authentication.
To use the Azure CLI login, open your terminal and run this command:
az login
After successfully logging in, you will need to create a storage account and blob container in your Azure subscription. You need this because this is where Pulumi stores the state of your infrastructure. We’ll do this in the next few steps.
$env: AZURE_STORAGE_ACCOUNT = "storage-account-name" $env: AZURE_STORAGE_KEY = "storage-account-primary-key"
Now, you’re all set to login to Pulumi. To do that, run this command:
pulumi login --cloud-url azblob://<blob-container-name>
We have successfully authenticated plum with Azure using our blob container as our Pulumi backend.
Next, we’ll learn how to create a new project in Pulumi.