description |
---|
Automatically generated file. DO NOT MODIFY |
// Code snippets are only available for the latest major version. Current major version is $v1.*// Dependenciesimport ( "context" msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" graphapplications "github.com/microsoftgraph/msgraph-sdk-go/applications" graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"//other-imports ) requestBody:=graphapplications.NewAddKeyPostRequestBody() keyCredential:=graphmodels.NewKeyCredential() type:="AsymmetricX509Cert"keyCredential.SetType(&type) usage:="Verify"keyCredential.SetUsage(&usage) key:= []byte("mIIDYDCCAki...") keyCredential.SetKey(&key) requestBody.SetKeyCredential(keyCredential) passwordCredential:=nullrequestBody.SetPasswordCredential(&passwordCredential) proof:="eyJ0eXAiOiJ..."requestBody.SetProof(&proof) // To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=goaddKey, err:=graphClient.Applications().ByApplicationId("application-id").AddKey().Post(context.Background(), requestBody, nil)