Skip to content

Instantly share code, notes, and snippets.

@vladbarosan
Created November 5, 2018 19:13
Show Gist options
  • Save vladbarosan/1390a443ce8ac1b241413a65ee4b9e9d to your computer and use it in GitHub Desktop.
Save vladbarosan/1390a443ce8ac1b241413a65ee4b9e9d to your computer and use it in GitHub Desktop.
useKv example go
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