Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hemantksingh/msgraphapi
https://github.com/hemantksingh/msgraphapi
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hemantksingh/msgraphapi
- Owner: hemantksingh
- Created: 2020-08-11T11:36:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-27T00:59:41.000Z (about 3 years ago)
- Last Synced: 2023-03-27T09:00:02.907Z (almost 2 years ago)
- Language: C#
- Size: 54.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MS Graph API
Provides integration with MS graph API using the client credentials flow for a [trusted background application](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-overview), that does not require a signed-in user for access to the MS Graph API.
## Tools for interacting with MS Graph API
Graph Explorer is a web-based tool that you can use to build and test requests using Microsoft Graph APIs. You can access Graph Explorer at: `https://developer.microsoft.com/en-us/graph/graph-explore`
## Building the application
```sh
# build with docker
docker build -t hemantksingh/msgraphapi .# build with dotnet
dotnet build
```## Running the application
Running the application requires the Azure AD [app registration](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-app-registration) details for authenticating with MS Identity platform and invoke the MS graph API with a token. The registration details can be provided by adding an `appsettings.secrets.json` file or exported as environment variables
```sh
# create an appsettings.secrets.json file
{
"AzureAD": {
"ClientId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"ClientSecret": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"TenantId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}
}# or export the following environment variables
AZUREAD_CLIENT_ID=xxxx
AZUREAD_CLIENT_SECRET=xxxx
AZUREAD_TENANT_ID=xxxx```
### Run with nginx reverse proxy
This runs the API behind an nginx reverse proxy which has basic authentication enabled
```sh
authPassword= docker compose -f docker-compose-nginx.yml up --build
```The API can be accessed at: http://localhost/azuread/swagger
### Run with haproxy load balancer
This runs the API behind HAProxy load balancer
```sh
docker compose -f docker-compose-haproxy.yml up --build
```You should be able to access
* haproxy `stats` page on the host at http://localhost:1337
* haproxy prometheus metrics at http://localhost/metrics
* haproxy [dataplane API](https://www.haproxy.com/blog/new-haproxy-data-plane-api/) at http://localhost:5555
```sh
curl --get --user admin:adminpwd \
http://localhost:5555/v2/services/haproxy/configuration/backends
```
* AzureAD API at http://localhost/azuread/swagger### Run with dotnet standalone
```sh
dtonet run
```The AzureAD API can be accessed at: http://localhost:4000/swagger