# Grafana Cloud Agent Auth Set up to add X-Scope-OrgID

**URL:** <https://community.grafana.com/t/grafana-cloud-agent-auth-set-up-to-add-x-scope-orgid/44212>\
**Category:** Grafana Cloud\
**Created:** [March 9, 2021, 8:48am UTC](https://community.grafana.com/t/grafana-cloud-agent-auth-set-up-to-add-x-scope-orgid/44212 "2021-03-09T08:48:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![suresh300567](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@suresh300567](https://community.grafana.com/u/suresh300567)\
**Post date:** [March 9, 2021, 8:48am UTC](https://community.grafana.com/t/grafana-cloud-agent-auth-set-up-to-add-x-scope-orgid/44212/1 "2021-03-09T08:48:46Z")

</div>

Hi Team  
What is the best way to add “X-Scope-OrgID” to grafana cloud agent.  
We are planning to use Cortex to receive all the data collected by Grafana Cloud Agent.

Our Initial approach was to use Prometheus to pull metrics and then send to cortex ,  
I was following this link , _[Authentication and Authorisation | Cortex (cortexmetrics.io)](https://cortexmetrics.io/docs/guides/auth/)_

As per the document : “When configuring the `remote_write` API in Prometheus there is no way to add extra headers. The user and password fields of http Basic auth, or Bearer token, can be used to convey the tenant ID and/or credentials” .  
Which means that i need to run Prometheus instance behind nginx reverse proxy.  
But now Prometheus instance is replaced by Grafana Cloud Agent , can some one help me the best possible way to add “X-Scope-OrgID” to GCA ?

---

<div class="post-metadata">

**Author:** ![rfratto](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/rfratto/32/14422_2.png) [@rfratto](https://community.grafana.com/u/rfratto)\
**Post date:** [March 9, 2021, 4:57pm UTC](https://community.grafana.com/t/grafana-cloud-agent-auth-set-up-to-add-x-scope-orgid/44212/2 "2021-03-09T16:57:11Z")

</div>

Hey! Tech lead of the Grafana Agent here.

That Cortex document is a little out of date. Prometheus added support for adding custom headers in 2.25.0, which is included in the Agent’s 0.13.0 release.

You can specify custom headers in the remote\_write section:

```
remote_write:
- url: some-url-for-cortex
  headers:
    X-Scope-OrgID: new-value

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![suresh300567](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@suresh300567](https://community.grafana.com/u/suresh300567)\
**Post date:** [March 10, 2021, 4:36pm UTC](https://community.grafana.com/t/grafana-cloud-agent-auth-set-up-to-add-x-scope-orgid/44212/3 "2021-03-10T16:36:46Z")

</div>

Hi @rfratto  
Thanks for your response .  
Do you have any recommendation in adding the headers . I tried adding headers to the file and get the below error while trying to run grafana-cloud-agent .

## “error loading config file /etc/grafana-cloud-agent/config.yml: yaml: unmarshal errors: line 53: field headers not found in type config.plain” . Below is the grafana-cloud-agent file i am using

server:  
log\_level: debug

http\_listen\_port: 12348  
grpc\_listen\_port: 0

prometheus:  
wal\_directory: /data/grafana-cloud-agent/wal  
global:  
scrape\_interval: 15s  
scrape\_timeout: 10s  
evaluation\_interval: 15s

integrations:  
agent:  
enabled: true  
node\_exporter:  
enabled: true  
prometheus\_remote\_write:  
- url: [http://Cortexurl:9009/api/prom/push](http://Cortexurl:9009/api/prom/push)  
name: Test  
basic\_auth :  
username: XX  
password: XXXX  
headers:  
name: TCS

* * *

---

<div class="post-metadata">

**Author:** ![rfratto](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/rfratto/32/14422_2.png) [@rfratto](https://community.grafana.com/u/rfratto)\
**Post date:** [March 10, 2021, 4:51pm UTC](https://community.grafana.com/t/grafana-cloud-agent-auth-set-up-to-add-x-scope-orgid/44212/4 "2021-03-10T16:51:40Z")

</div>

I’m having a hard time telling what the problem might be without it being formatted as code and keeping the indentation. I can confirm this works for me:

```
server:
  log_level: info
  http_listen_port: 12345

prometheus:
  wal_directory: /tmp/agent
  global:
    scrape_interval: 5s
  configs:
    - name: test
      host_filter: false
      scrape_configs:
        - job_name: local_scrape
          static_configs:
            - targets: ['127.0.0.1:12345']
              labels:
                cluster: 'localhost'
      remote_write:
        - url: http://localhost:9009/api/prom/push
          headers:
            name: test

```

Can you make sure your indentation is correct and that you are running Grafana Agent v0.13.0?

---

<div class="post-metadata">

**Author:** ![suresh300567](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@suresh300567](https://community.grafana.com/u/suresh300567)\
**Post date:** [March 10, 2021, 5:55pm UTC](https://community.grafana.com/t/grafana-cloud-agent-auth-set-up-to-add-x-scope-orgid/44212/5 "2021-03-10T17:55:45Z")

</div>

Am afraid it didn’t worked for me and still throws the same error  
I | error loading config file /etc/grafana-cloud-agent/confi1.yml: yaml: unmarshal errors:  
line 26: field headers not found in type config.plain , i have attached the file which i changed as per your comment .

Also check my initial yaml file

 ![grafanacloudagent](https://us1.discourse-cdn.com/grafana/original/2X/5/52020cd80cda0756c1a5230e657d36f1345c97ba.png) ![Communtity GCA file](https://us1.discourse-cdn.com/grafana/original/2X/b/bc1e60af9209d35a0ae614c5f7c8b8a948168805.png)
