Skip to content

Managed Identity not supported #4878

Closed
Closed
@vk0125

Description

@vk0125

Describe the bug
I used managed Identity to access storage account when cortex stores the data. Earlier I used, storage account access key, it worked very well. However, from security point of view, we decided to use managed Identity and for that I am getting errors as below:

Logs:
error loading config from /etc/cortex/cortex.yaml: Error parsing config file: yaml: unmarshal errors:
 line 15: field msi_resource not found in type azure.Config
 line 16: field user_assigned_id not found in type azure.Config

To Reproduce
Steps to reproduce the behavior:

  1. Use Helm to start Cortex (version : 1.13.0)
  2. Check Pod status
  3. If pods are not running , Check logs

Expected behavior
With managed Identity , it should be able to access storage account.

Environment:

  • Infrastructure: Kubernetes
  • Deployment tool: helm
  • User Managed Identity with "StorageAccountBlobContributor" access for the target Storage Account

Additional Context
Config in values-override.yaml

config:
  blocks_storage:
    backend: azure
    azure:
      account_name: StorageAccountName
      account_key: StorageAccountAccessKey
      msi_resource: StorageAcccountEndpointUrl
      user_assigned_id: ManagedIdentityClientId
      container_name: StorageAccountContainerName
      endpoint_suffix: "blob.core.windows.net"

Helm command used:

helm install -f values-override.yaml  \
  --set config.blocks_storage.azure.account_name="<StorageAccoutName>" \
  --set config.blocks_storage.azure.msi_resource="<StorageAccoutEndpointUrl>" \
  --set config.blocks_storage.azure.user_assigned_id="<ManagedIdentityClientId>" \
  --set config.blocks_storage.azure.container_name="<StorageAccoutContainerName>" \
  cortex . --namespace cortex --debug

Due to lack of documentation on Cortex, I found it difficult to know what exactly the msi_resouce value should be.
For msi_resource, I passed the endpoint url in this format: "https://StorageAccoutName.blob.core.windows.net"
Reference1: thanos-io/thanos#3957 (comment)
Reference2: https://learn.microsoft.com/en-us/azure/storage/common/storage-auth-aad-app?tabs=dotnet#azure-storage-resource-id

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions