No description
Find a file
kpcraig e63c0723a3
Merge pull request #2 from hashicorp/compliance/update-headers-batch-4
[IND-4227] [COMPLIANCE] Update Copyright Headers (Batch 4 of 4)
2026-01-22 15:53:09 -05:00
.github [Compliance] - PR Template Changes Required 2025-07-03 10:10:46 +00:00
applications Merge pull request #2 from hashicorp/compliance/update-headers-batch-4 2026-01-22 15:53:09 -05:00
.copywrite.hcl copywrite headers 2024-01-17 11:58:22 -08:00
.gitignore Initial outline 2023-12-21 13:50:05 -08:00
CODEOWNERS Create CODEOWNERS 2024-01-10 09:13:43 -08:00
go.mod Initial outline 2023-12-21 13:50:05 -08:00
go.sum Initial outline 2023-12-21 13:50:05 -08:00
LICENSE [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 4) 2025-12-08 16:54:29 +00:00
Makefile copywrite headers 2024-01-17 11:58:22 -08:00
README.md Correct README on yml files 2023-12-21 14:04:40 -08:00

vault-msgraph-sdk

This is an autogenerated Go SDK for Azure using kiota with the APIs that HashiCorp Vault needs.

It is mostly a drop-in replacement for https://github.com/microsoftgraph/msgraph-sdk-go/.

Generate

To generate or regenerate the SDK:

rm *.yml
make generate

If you need to add more APIs, either add them to the APIS line at the top of the Makefile or specify them on the command-line:

make generate APIS="Applications.yml Mail.yml"

Each API's SDK will be put into the corresponding subdirectory, e.g., Applications.yml will be put in applications/.

Example Usage


import (
	"fmt"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	msgraphsdk "github.com/hashicorp/vault-msgraph-sdk/applications"
	mscore "github.com/microsoftgraph/msgraph-sdk-go-core"
	"github.com/hashicorp/vault-msgraph-sdk/applications/applications"
	auth "github.com/microsoftgraph/msgraph-sdk-go-core/authentication"
)

func newClient(graphURI string, creds azcore.TokenCredential, scopes []string) (*msgraphsdkgo.ApiClient, error) {
	// ...
	authProvider, err := auth.NewAzureIdentityAuthenticationProviderWithScopes(creds, scopes)
	if err != nil {
		return nil, err
	}

	adapter, err := mscore.NewGraphRequestAdapterBase(authProvider, mscore.GraphClientOptions{})
	if err != nil {
		return nil, err
	}

	adapter.SetBaseUrl(fmt.Sprintf("%s/v1.0", graphURI))
	client := msgraphsdk.NewApiClient(adapter)
	return client, nil
}