Backup to Azure blob storage error

Hello
I am new in restic. I am trying to perform a backup to Azure Blob storage but I am getting following error:
Fatal: unable to open repo at azure:repo:/: NewBasicClient: azure: account name is not valid: it must be between 3 and 24 characters, and only may contain numbers and lowercase letters:
I have AZURE_ACCOUNT_NAME & AZURE_ACCOUNT_KEY as environment variables and AZURE_ACCOUNT_NAME is in lower case (20 characteres).
Could you please help to find the root cause of the error? Thanks

Hi @ailb90 and welcome to the restic community! :slight_smile:

First of all, have you checked out the documentation of restic here Microsoft Azure Blob Storage?
If you have further questions which are not answered please let us know.

Also if the documentation does answer your question, please let us know as well so we can mark this thread as solved.

Hi @moritzdietz. Thanks for your prompt answer.
I have followed the documentation Microsoft Azure Blob Storage. I add Azure account and key details into variable, then try to create a new repository with restic -r azure:repo:/bkpfolder init and the error appears. I have checked the blob storage and bkpfolder has been created, but backup is not being performed.

My script:

export RESTIC_REPOSITORY=azure:backup:/bkpfolder/
export AZURE_ACCOUNT_NAME=
export AZURE_ACCOUNT_KEY=
sudo restic -r $RESTIC_REPOSITORY  backup /folder

Error:
Fatal: unable to open repo at azure:backup:/bkpfolder/: NewBasicClient: azure: account name is not valid: it must be between 3 and 24 characters, and only may contain numbers and lowercase letters:

Hi
Problem solved. I have used sudo to run the backup but not to create repo. Removing sudo in backup sentence it works

The reason this didn’t work is the following.
If you run the command with sudo and don’t use sudo -E the environment of your current user does not get transferred. So the just exported variables do not exist in that sense.
Here is the manpage section of sudo -E

-E, --preserve-env
Indicates to the security policy that the user wishes to pre‐
serve their existing environment variables. The security
policy may return an error if the user does not have permis‐
sion to preserve the environment.

1 Like