Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Azure] Unable to check if key vault secret exists using environment variables #903

Closed
victornoventa opened this issue May 19, 2021 · 2 comments · Fixed by #945
Closed
Labels

Comments

@victornoventa
Copy link

victornoventa commented May 19, 2021

I have had issues while running my tests that rely on modules/azure/keyvault to check if a secret exists. I have everything set as the instructions tell me to do and everything goes fine with my service principal information set as environment variables. But I can't check if a secret exists because it relies on Az CLI instead. Is there any specific reason for having this relying on NewAuthorizerFromCLI

authorizer, err := kvauth.NewAuthorizerFromCLI()

Instead of relying on NewAuthorizerFromEnvironment?

https://github.com/Azure/azure-sdk-for-go/blob/master/services/keyvault/auth/auth.go#L19

I mean, I've seen other places using this Authorizer instead:

func NewAuthorizer() (*autorest.Authorizer, error) {

@HadwaAbdelhalem
Copy link
Contributor

HadwaAbdelhalem commented May 20, 2021

@victornoventa Operations on Azure Keyvault are 2 groups, first group "Management plan "that creates, update or detele the vault and set the permissions on it. the second group "Data plan" that add, updates, retrieve, or deletes the values stored within the vault

To run any operation on the data within azure keyvault you need to use a data plan Authorizer, while the remaining resources operations are using the management plan authorizer.

With that said, I think we should expand the newKeyVaultAuth

func NewKeyVaultAuthorizerE() (*autorest.Authorizer, error) {
to offer the same flexibity the newAuthorizer offers
func NewAuthorizer() (*autorest.Authorizer, error) {

For more details please check this

@HadwaAbdelhalem
Copy link
Contributor

@victornoventa a fix was merged to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants