Add shadow-api-detection sample for Azure API Center#39
Add shadow-api-detection sample for Azure API Center#39
Conversation
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
| ## 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.
@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.
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.
@copilot the curl command doesn't refer to the mock CRUD API in this sample
There was a problem hiding this comment.
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.
@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.
Removed the .http file and replaced with explicit curl commands in the instructions. (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.
@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.
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": [ |
…and fix curl command Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
…rameter Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
|
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 <11164679+waldekmastykarz@users.noreply.github.com>
Updated sample to comply with copilot-instructions.md:
(b3fb72c) |
|
@copilot please also:
|
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
|
@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 <11164679+waldekmastykarz@users.noreply.github.com>
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.