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.
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?
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:
Or if you’re a classic kinda guy, something like this:
Still, want to go forward with the blob storage? Great, onwards to the 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?
- 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:
- Open “Variables”
Navigate to the edit mode of the Pipeline, and access “Variables” (like in the screenshot below)
- Enter the details
You’ll need to add 2 variables, that’ll then work as environment variables for the pipeline. They are as follows:
This is the Connection string from your Azure storage account
Suppose this is pretty self-explanatory, but it’s the Key from the same view as before.
And we’re done! On more obstacle to overcome on your path to fully automated deployments! :)
- Wilfried Woivré has a great article about using Azure storage for hosting the state of the stack:
- If you’re confused by Azure Service Connections, here’s a bit about them:
- How to import an Azure DevOps Git repository… From another Azure DevOps organization? - September 27, 2022
- How to fix NU3028 and NU3037 errors in Azure DevOps builds? - September 20, 2022
- How to kill the process causing the “MSB3021 Unable to copy file — The process cannot access the file because it is being used by another process.” error? - September 13, 2022