Created
November 5, 2018 19:13
-
-
Save vladbarosan/1390a443ce8ac1b241413a65ee4b9e9d to your computer and use it in GitHub Desktop.
useKv example go
This file contains 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
package main | |
import ( | |
mgmtkv "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2018-02-14/keyvault" | |
dataplanekv "github.com/Azure/azure-sdk-for-go/services/keyvault/v7.0/keyvault" | |
"github.com/Azure/go-autorest/autorest/azure" | |
"github.com/Azure/go-autorest/autorest/azure/auth" | |
) | |
func sampleKV(sess *AzureSession) { | |
mgmtAuthorizer, err := auth.NewAuthorizerFromFileWithResource(azure.PublicCloud.ResourceManagerEndpoint) | |
mgmtClient := mgmtkv.NewVaultsClient(sess.SubscriptionID) | |
mgmtClient.Authorizer = mgmtAuthorizer | |
dataplaneAuthorizer, err := auth.NewAuthorizerFromFileWithResource(azure.PublicCloud.KeyVaultEndpoint) | |
dataplaneClient := dataplanekv.New() | |
dataplaneClient.Authorizer = dataplaneAuthorizer | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment