Skip to content

fix(azure): default endpoint_suffix to blob.core.windows.net#7687

Open
pujitha24 wants to merge 3 commits into
cortexproject:masterfrom
pujitha24:auto/issue-5449
Open

fix(azure): default endpoint_suffix to blob.core.windows.net#7687
pujitha24 wants to merge 3 commits into
cortexproject:masterfrom
pujitha24:auto/issue-5449

Conversation

@pujitha24

Copy link
Copy Markdown

Motivation:
After commit da2ad99 switched Cortex's Azure bucket client to Thanos'
objstore, block-storage-dependent components (alertmanager, ruler,
store-gateway, compactor, etc.) hang on startup when endpoint_suffix
is left empty, failing with DNS errors and no clear message, e.g.:

Get "https://<account>./<container>?restype=container": dial tcp:
lookup <account>. on 192.168.5.3:53: no such host

Root cause: Cortex builds the Thanos azure.Config struct directly in
pkg/storage/bucket/azure/bucket_client.go and calls
NewBucketWithConfig, which bypasses Thanos' parseConfig/DefaultConfig
that would otherwise seed Endpoint with "blob.core.windows.net". Because
Cortex's own azure.endpoint-suffix flag defaulted to "", the resulting
FQDN was <account>., which is invalid.

Approach:
Default the azure.endpoint-suffix flag to "blob.core.windows.net",
matching Thanos' DefaultConfig. This restores the pre-da2ad99
out-of-the-box behavior for Azure public cloud while still allowing the
value to be overridden for sovereign/government clouds. The
connection-string / Azurite path is unaffected because Thanos never reads
Endpoint when a connection string is set.

Test config default and generated config docs are updated to match.

Validation:
go build ./...
go test -tags "netgo slicelabels" ./pkg/storage/bucket/...
make doc BUILD_IN_CONTAINER=false # regenerated config docs
All passed.

Fixes #5449

Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com

Motivation:
After commit da2ad99 switched Cortex's Azure bucket client to Thanos'
objstore, block-storage-dependent components (alertmanager, ruler,
store-gateway, compactor, etc.) hang on startup when `endpoint_suffix`
is left empty, failing with DNS errors and no clear message, e.g.:

    Get "https://<account>./<container>?restype=container": dial tcp:
    lookup <account>. on 192.168.5.3:53: no such host

Root cause: Cortex builds the Thanos `azure.Config` struct directly in
pkg/storage/bucket/azure/bucket_client.go and calls
`NewBucketWithConfig`, which bypasses Thanos' `parseConfig`/`DefaultConfig`
that would otherwise seed `Endpoint` with "blob.core.windows.net". Because
Cortex's own `azure.endpoint-suffix` flag defaulted to "", the resulting
FQDN was `<account>.`, which is invalid.

Approach:
Default the `azure.endpoint-suffix` flag to "blob.core.windows.net",
matching Thanos' `DefaultConfig`. This restores the pre-da2ad99
out-of-the-box behavior for Azure public cloud while still allowing the
value to be overridden for sovereign/government clouds. The
connection-string / Azurite path is unaffected because Thanos never reads
`Endpoint` when a connection string is set.

Test config default and generated config docs are updated to match.

Validation:
    go build ./...
    go test -tags "netgo slicelabels" ./pkg/storage/bucket/...
    make doc BUILD_IN_CONTAINER=false   # regenerated config docs
All passed.

Fixes cortexproject#5449

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 14, 2026 02:54
@dosubot dosubot Bot added azure component/alertmanager component/compactor component/rules Bits & bobs todo with rules and alerts: the ruler, config service etc. component/store-gateway type/bug labels Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression in Cortex’s Azure object storage configuration by defaulting endpoint_suffix to the Azure public cloud value (blob.core.windows.net). This prevents Cortex from constructing an invalid FQDN (<account>.) when Cortex directly instantiates Thanos’ azure.Config and bypasses Thanos’ internal defaulting logic.

Changes:

  • Default azure.endpoint-suffix flag to blob.core.windows.net.
  • Update the Azure config default test to match the new flag default.
  • Update generated configuration docs and add a changelog entry documenting the behavior change.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/storage/bucket/azure/config.go Changes the CLI flag default for Azure endpoint-suffix to a valid public cloud suffix.
pkg/storage/bucket/azure/config_test.go Updates the default-config assertion to include the new Endpoint default.
docs/configuration/config-file-reference.md Updates the documented default for endpoint_suffix across relevant Azure config blocks.
docs/blocks-storage/store-gateway.md Updates the documented default for endpoint_suffix in store-gateway config docs.
docs/blocks-storage/querier.md Updates the documented default for endpoint_suffix in querier config docs.
CHANGELOG.md Documents the Azure defaulting bugfix and its impact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 34 to +36
f.Var(&cfg.StorageConnectionString, prefix+"azure.connection-string", "The values of `account-name` and `endpoint-suffix` values will not be ignored if `connection-string` is set. Use this method over `account-key` if you need to authenticate via a SAS token or if you use the Azurite emulator.")
f.StringVar(&cfg.ContainerName, prefix+"azure.container-name", "", "Azure storage container name")
f.StringVar(&cfg.Endpoint, prefix+"azure.endpoint-suffix", "", "Azure storage endpoint suffix without schema. The account name will be prefixed to this value to create the FQDN")
f.StringVar(&cfg.Endpoint, prefix+"azure.endpoint-suffix", "blob.core.windows.net", "Azure storage endpoint suffix without schema. The account name will be prefixed to this value to create the FQDN")
Comment on lines 858 to +861
# Azure storage endpoint suffix without schema. The account name will be
# prefixed to this value to create the FQDN
# CLI flag: -alertmanager-storage.azure.endpoint-suffix
[endpoint_suffix: <string> | default = ""]
[endpoint_suffix: <string> | default = "blob.core.windows.net"]

@friedrichg friedrichg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 15, 2026
@friedrichg

Copy link
Copy Markdown
Member

@pujitha24 modified cortex-config-schema.json should be included in the PR

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
@pujitha24

Copy link
Copy Markdown
Author

@friedrichg good catch — I'd missed regenerating the schema. I ran go run -tags slicelabels ./tools/doc-generator -json-schema and committed the updated schemas/cortex-config-schema.json, which now adds "default": "blob.core.windows.net" to the endpoint_suffix field in all four Azure sections. This matches the generator output exactly and should clear the failing "Check Generated Documentation" lint step.

On the Copilot note about the connection-string help-text wording: that phrasing predates this PR and isn't related to the defaulting bugfix, so I've left it out of scope here rather than expanding this change.

Signed-off-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure component/alertmanager component/compactor component/rules Bits & bobs todo with rules and alerts: the ruler, config service etc. component/store-gateway lgtm This PR has been approved by a maintainer size/S type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure storage needs the endpoint suffix after v1.15.0

3 participants