Grafana Cloud Mimirtool usage for uploading alertrules to grafana-cloud

Hi,
im trying to load some alertrules through a script into grafana cloud. Therefore im trying to use mimirtool and first i used provided first_rules.yml from manual for test.

Tryed: (Variables are set before)
docker run --rm -e MIMIR_ADDRESS -e MIMIR_API_KEY -e MIMIR_API_USER -v $(pwd):/local/ grafana/mimirtool rules load /local/first_rules.yml

Result:

time="2022-12-08T08:45:41Z" level=error msg="server returned HTTP status 401 Unauthorized: {\"message\":\"invalid username or password\",\"traceID\":\"hidden\"}" fields.msg="{\"message\":\"invalid username or password\",\"traceID\":\"hidden\"}" status="401 Unauthorized"
mimirtool: error: load operation unsuccessful, unable to contact Grafana Mimir API: GET request to https://hidden.grafana.net/prometheus/config/v1/rules/first_rules/shopping_service_rules_and_alerts failed: server returned HTTP status 401 Unauthorized: {"message":"invalid username or password","traceID":"hidden"}, try --help

But im not able to get authenticated and so the rules are not applicable for me.

Is there anyone which can help me?

Hi Andreas,

Can you try the below command

docker run --rm -e MIMIR_ADDRESS -e MIMIR_API_KEY -e MIMIR_TENANT_ID -v $(pwd):/local/ grafana/mimirtool rules load /local/first_rules.yml

Where the ENV Variables are:

MIMIR_ADDRESS = <Prometheus Instance URL> #Examplehttps://prometheus-us-central1.grafana.net
MIMIR_API_KEY = <Your Grafana Cloud API Key>
MIMIR_TENANT_ID = <Your Grafana Cloud Prometheus Instance ID> #Example → 663863

Hi IshanJain,
thank you very much, this helped me, it works. I had a wrong tenant-id in variable set and also used the url https://[slug].grafana.net for the address variable which confused me.

Best thanks and regards
Andreas