Encrypt file using sops using a key store in Azure Vault
See original GitHub issueThis is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az account get-access-token
Errors:
Get Token request returned http error: 400 and server response: {"error":"invalid_resource","error_description":"AADSTS500011: The resource principal named https://vault.azure.net was not found in the tenant named [TENTANT_ID]. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.
Traceback (most recent call last):
...
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
az cloud set -n AzureChinaCloud
- this doesn’t seem to make a difference but is suppose to change the CLI to know its using China Cloud- Have a key vault created and a key inside with encrypt and decrypt permission
sops --encrypt --azure-kv https://[VAULT_NAME].vault.azure.cn/keys/[KEY_NAME] secrets.yaml
Expected Behavior
Instead of authorization using https://vault.azure.net
it uses *.azure.cn
so that it can find the correct tenant
Environment Summary
Linux-3.10.0-1062.4.3.el7.x86_64-x86_64-with-centos-7.9.2009-Core
Python 3.6.8
Installer: RPM
azure-cli 2.18.0
Additional Context
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Tutorial: Encrypt and decrypt blobs using Azure Key Vault
In this tutorial, you learn how to use client-side encryption to encrypt and decrypt blobs using a key stored with Azure Key Vault....
Read more >Encrypt your Kubernetes Secrets with Mozilla SOPS
This article demonstrates how to encrypt and decrypt Kubernetes secrets ( YAML files) using SOPS in combination with Azure Key Vault, which ...
Read more >GitOps: Encrypting secrets with Mozilla SOPS - jooooel
A developer creates a new file that contains a secret. Before commiting and pushing it to the remote repository, they will encrypt the...
Read more >How to commit encrypted files to Git with Mozilla SOPS
SOPS is an editor of encrypted files that supports YAML, JSON, ENV, INI, and BINARY formats and encrypts with AWS KMS, GCP KMS,...
Read more >Using Mozilla/SOPS for secret management
SOPS, short for Secrets OPerationS, is a tool to encrypt files so that they can safely be stored in public git repositories. It...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@yonzhan @houk-ms @jiasli any news regarding the fix? I’m trying to find a workaround but couldn’t find any.
EDIT:
@Shaun-Harrison found a workaround in sops code 😃
https://github.com/mozilla/sops/blob/38b25bd449619e1d6da20e637702f7c73203aa44/azkv/keysource.go#L54-L81
As you might see here, sops is taking configs from environment variables, this means that by setting the environment variable to the proper value it will make everything works just fine.
Obviously, it would be nice to have this information in the error message!
before running the sops command you must run:
export AZURE_ENVIRONMENT="azurechinacloud"
Hope this works for you too 👍
@romeomorcia-wipro, Thank you for the SOPS solution.
This is never an Azure CLI issue as I explained in https://github.com/Azure/azure-cli/issues/16729#issuecomment-772179264.
You may reach out to SOPS and instruct them to follow the standard Key Vault’s
WWW-Authenticate
challenge protocol instead.