-
Notifications
You must be signed in to change notification settings - Fork 40
Add support for Azure Key Vault and updated deps #204
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
Merged
+390
−52
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f213a22
getting ready, rename old vault support, update readme, makefile, etc.
markxnelson 4e832ed
initial impl
markxnelson 90e4ca6
first build
markxnelson 22a6fc4
working on auth
markxnelson dbbd9a1
working
markxnelson 6f8bbb2
udpate readme with auth details
markxnelson 6a3defc
update log message re auth
markxnelson 7c15bcc
update tpl:
markxnelson b4dc047
get username and password from az key vault
markxnelson 4c66512
update godror
markxnelson b7e4301
update toml
markxnelson 38ed114
update prometheus
markxnelson 917aeb4
update oci sdk
markxnelson f73f1a4
update docs to prepare for release
markxnelson 1bfd5bf
update docs to prepare for release
markxnelson e67b5fa
update TPL
markxnelson fb47b18
Merge branch 'main' into 200
markxnelson a793f22
review commetns
markxnelson ff09e29
readme updates
markxnelson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) 2023, 2025, Oracle and/or its affiliates. | ||
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
||
package azvault | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/prometheus/common/promslog" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity" | ||
"github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets" | ||
) | ||
|
||
func GetVaultSecret(vaultId string, secretName string) string { | ||
promLogConfig := &promslog.Config{} | ||
logger := promslog.New(promLogConfig) | ||
|
||
vaultURI := fmt.Sprintf("https://%s.vault.azure.net/", vaultId) | ||
|
||
// create a credential | ||
cred, err := azidentity.NewDefaultAzureCredential(nil) | ||
if err != nil { | ||
logger.Error("Failed to obtain an Azure Credential", "err", err) | ||
markxnelson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// establish a connection to the key vault client | ||
client, err := azsecrets.NewClient(vaultURI, cred, nil) | ||
markxnelson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// get the secret - empty string version means "latest" | ||
version := "" | ||
secret := "" | ||
resp, err := client.GetSecret(context.TODO(), secretName, version, nil) | ||
if err != nil { | ||
logger.Error("Failed to get secret from vault", "err", err) | ||
} else { | ||
secret = *resp.Value | ||
} | ||
|
||
return strings.TrimRight(secret, "\r\n") // make sure a \r and/or \n didn't make it into the secret | ||
markxnelson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does Azure support the equivalent of OCI workload identity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see authentication, right below this, it has links to that info