Pulumi Azure Next-gen logo/splash

Pulumi task on Azure DevOps fails with error “azureblob.OpenBucket: accountName is required”

This post was most recently updated on September 25th, 2021.

3 min read.

This article explains how to fix one of the many issues you might face when configuring Pulumi deployments for your Azure DevOps Pipelines! The particular error you may run into was “azureblob.OpenBucket: accountName is required” – what a descriptive one, when there’s no accountName to be specified anywhere!

But first – let’s get through the basics. Namely…

Pulumi?”, you ask – “What’s that?

Well, let me give you a 1-line response to that.


What is Pulumi?

Pulumi is an incredibly flexible infrastructure-as-a-code solution that supports C# (among other languages), comes with an Azure DevOps integration, and makes it possible for you to define and deploy any Azure artifacts within your standard build pipeline.


One very long line, that is. But what was the error I ran into this time?

Problem

Table of Contents

So, that pesky aforementioned Pulumi is giving you trouble when you’re trying to configure the Pulumi build task for your pipelines.

And please do note; configure it for your Pipeline, not for your Release.

Anyway, your task is erroring out and you’re left with an unfinished deployment. Your log will have some rows about the stack – so that’s good – but nothing gets deployed.

The whole error message might be something like this:

##[error]Pulumi CLI login command failed.

error: problem logging in: unable to open bucket azblob://pulumistatedev: azureblob.OpenBucket: accountName is required

Ah – the error message is not quite clear, but the issue is simple.

Pulumi can host your stack state information in multiple different sources: Pulumi backend that you host yourself, Pulumi-as-a-Service, or in blob storage on Azure.

This exception is then thrown when you have configured a blob storage to be used for storing your stack’s state. So essentially, having a storage account is a prerequisite for this how-to.

Note, that if you’re NOT trying to use Azure blob storage to host your state information, please host it somewhere else and remove a reference like this from your build:

Where to configure the name of the Azure storage account hosting the state of your Pulumi stack?
Where to configure the name of the Azure storage account hosting the state of your Pulumi stack when using YAML?

Or if you’re a classic kinda guy, something like this:

Where to configure the name of the Azure storage account hosting the state of your Pulumi stack?
Where to configure the name of the Azure storage account hosting the state of your Pulumi stack when using Classic pipelines?

Still, want to go forward with the blob storage? Great, onwards to the solution!

Solution

In case you DO want to proceed with using Azure blob storage to host your Stack state, here’s how you can fix your pipeline:

Time needed: 10 minutes.

How to fix “azureblob.OpenBucket: accountName is required” error on Pulumi deployment task on Azure DevOps?

  1. Fetch the details for your Azure storage account

    You’re going to need a storage account, the name of a container in it (“pulumistatedev” in my example), and then navigate to “Access keys” to fetch the key (1) and connection string (2), as shown in the screenshot below:


  2. Open “Variables”

    Navigate to the edit mode of the Pipeline, and access “Variables” (like in the screenshot below)

    How to access Build Pipeline Variables on Azure DevOps?

  3. Enter the details

    You’ll need to add 2 variables, that’ll then work as environment variables for the pipeline. They are as follows:

    AZURE_STORAGE_ACCOUNT:
    This is the Connection string from your Azure storage account

    AZURE_STORAGE_KEY:
    Suppose this is pretty self-explanatory, but it’s the Key from the same view as before.

    Azure DevOps Build Pipeline Variables for Pulumi

And we’re done! On more obstacle to overcome on your path to fully automated deployments! :)

References

mm
4.5 2 votes
Article Rating
Subscribe
Notify of
guest
3 Comments
most voted
newest oldest
Inline Feedbacks
View all comments