-
Notifications
You must be signed in to change notification settings - Fork 6
Add shadow-api-detection sample for Azure API Center #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: waldekmastykarz <[email protected]>
Co-authored-by: waldekmastykarz <[email protected]>
waldekmastykarz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Minimal path to awesome | ||
|
|
||
| 1. Clone this repository (or [download this solution as a .ZIP file](https://pnp.github.io/download-partial/?url=https://github.com/pnp/proxy-samples/tree/main/samples/shadow-api-detection) then unzip it) | ||
| 1. Create an Azure API Center instance and register your organization's APIs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot provide a script using az to onboard the API as required by this sample. Also, generate the OpenAPI spec folks will need to onboard the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added setup.sh script with az commands and api.contoso.com.json OpenAPI spec for onboarding the API. (205657f)
| - `serviceName`: Your API Center instance name | ||
| 1. Sign in to Azure using `az login` | ||
| 1. Start Dev Proxy in recording mode: `devproxy --config-file devproxyrc.json --record` | ||
| 1. Issue API requests through Dev Proxy using the `demo-requests.http` file or by running `curl -ikx http://127.0.0.1:8000 https://jsonplaceholder.typicode.com/posts` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot the curl command doesn't refer to the mock CRUD API in this sample
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. The curl command now shows both the registered API (https://api.contoso.com/products) and shadow API requests. (205657f)
| - `serviceName`: Your API Center instance name | ||
| 1. Sign in to Azure using `az login` | ||
| 1. Start Dev Proxy in recording mode: `devproxy --config-file devproxyrc.json --record` | ||
| 1. Issue API requests through Dev Proxy using the `demo-requests.http` file or by running `curl -ikx http://127.0.0.1:8000 https://jsonplaceholder.typicode.com/posts` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot how folks should use the .http file so that the requests are processed by Dev Proxy? Either be specific or remove the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the .http file and replaced with explicit curl commands in the instructions. (205657f)
| "workspace": "default", | ||
| "createApicEntryForNewApis": true | ||
| }, | ||
| "logLevel": "information" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot This is default so we can remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed logLevel from the config. (205657f)
| - `resourceGroupName`: The resource group containing your API Center | ||
| - `serviceName`: Your API Center instance name | ||
| 1. Sign in to Azure using `az login` | ||
| 1. Start Dev Proxy in recording mode: `devproxy --config-file devproxyrc.json --record` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot --record can be encoded in the config file to simplify starting dev proxy. Also devproxyrc.json is default config name so it's automatically picked up by dev proxy without having to name it explicitly. Simplify the whole command to devproxy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added record: true to the config and simplified the command to just devproxy. (205657f)
| "alt": "Dev Proxy detecting shadow APIs not registered in Azure API Center" | ||
| } | ||
| ], | ||
| "authors": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Change the author to waldekmastykarz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed author to waldekmastykarz in both sample.json and README.md. (205657f)
…and fix curl command Co-authored-by: waldekmastykarz <[email protected]>
…rameter Co-authored-by: waldekmastykarz <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Validation failed!File: samples/shadow-api-detection/assets/sample.json
|
|
@copilot please review and update this sample to comply with the updated .github/copilot-instructions.md |
Co-authored-by: waldekmastykarz <[email protected]>
Updated sample to comply with copilot-instructions.md:
(b3fb72c) |
|
@copilot please also:
|
Co-authored-by: waldekmastykarz <[email protected]>
|
@copilot One more thing: please update the screenshot in |
I'm unable to generate actual screenshots as I don't have access to a running Dev Proxy instance or screen capture capabilities. The screenshot would need to be created manually by running the sample and capturing the Dev Proxy output showing the shadow API detection report. Currently, the README has a placeholder comment indicating where the screenshot should be added once available. |
|
@copilot Please make the following changes:
This keeps the sample configs minimal and easier to understand. |
Co-authored-by: waldekmastykarz <[email protected]>
Moved all config files ( |
.devproxyfolderworkspace,createApicEntryForNewApis)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.