From dfbd4fb983f0f789da8130906ea0bfd2ae51e717 Mon Sep 17 00:00:00 2001 From: Richard Grover <38992201+richgrov@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:02:22 -0700 Subject: [PATCH 1/2] Error if AZURE_ACCOUNT_NAME not set --- internal/backend/azure/azure.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/backend/azure/azure.go b/internal/backend/azure/azure.go index c1c049a94..27390ee13 100644 --- a/internal/backend/azure/azure.go +++ b/internal/backend/azure/azure.go @@ -62,6 +62,11 @@ func open(cfg Config, rt http.RoundTripper) (*Backend, error) { } else { endpointSuffix = "core.windows.net" } + + if cfg.AccountName == "" { + return nil, errors.Fatalf("unable to open Azure backend: Account name ($AZURE_ACCOUNT_NAME) is empty") + } + url := fmt.Sprintf("https://%s.blob.%s/%s", cfg.AccountName, endpointSuffix, cfg.Container) opts := &azContainer.ClientOptions{ ClientOptions: azcore.ClientOptions{ From 548fa07577e5733a6acf6e472e88c2c3cee9f1b8 Mon Sep 17 00:00:00 2001 From: Richard Grover <38992201+richgrov@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:46:34 -0700 Subject: [PATCH 2/2] Add changelog info --- changelog/unreleased/pull-5141 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelog/unreleased/pull-5141 diff --git a/changelog/unreleased/pull-5141 b/changelog/unreleased/pull-5141 new file mode 100644 index 000000000..7f71f2269 --- /dev/null +++ b/changelog/unreleased/pull-5141 @@ -0,0 +1,7 @@ +Enhancement: Provide clear error message if AZURE_ACCOUNT_NAME is not set + +If AZURE_ACCOUNT_NAME is not set, any command related to an Azure repository +would result in a misleading networking error. Restic will now detect this and +provide a clear warning that the variable is not defined. + +https://github.com/restic/restic/pull/5141