API Management Authorization Samples - Reply to New Github Discussion Comments using Azure functions
This sample uses API Management Authorizations + Azure functions to post automated reply in Github. Azure function is used as a trigger an execution at a regular interval and the APIM is used to attach the access token when calling Github endpoints.
For live demo, try making a comment in APIManagementAuthorizations#2
- Download public schema of Github GraphQL endpoints here
- Create an API Management in https://portal.azure.com
- Go to APIs > + Add API > GraphQL. Check "Upload schema" box and upload the schema downloaded in step1.
- Attach an authorization to the APIs following this step.
- Run ReplyToNewGithubDiscussionTimeTrigger Azure Functions locally using your preferred methods. Detailed instructions on each method can be found in this doc. Note that these environment variables need to be set:
APIM_SERVICE_NAME
,SUBSCRIPTION_KEY
,GITHUB_REPO_NAME
,GITHUB_REPO_OWNER
,GITHUB_DISCUSSION_NUMBER
.