-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Is your feature request related to a problem? Please describe.
The Azure docs have a REST API explorer, and that is helpful for one-off testing, but isn't very helpful for scripting or for REST APIs that haven't made their way into the Azure CLI.
Describe the solution you'd like
I'd like to propose adding a new subcommand, such as az curl
or az rest
, that allows a user to call a resource provider with a custom payload. I could see the feature looking something like this:
az {curl,rest} /subscriptions/{subscriptionId}/providers/{Resource.Provider}/{endpoint} \
--api-version {version} \
--payload '{"json": "payload"}'
or
az {curl,rest} /{Resource.Provider}/{endpoint} \
--subscription {sub-id} \
--api-version {version} \
--payload '{"json": "payload"}'
or
az {curl,rest} {endpoint} \
--subscription {sub-id} \
--resource-provider {Resource.Provder} \
--api-version {version} \
--payload '{"json": "payload"}'
This would allow users to pass JSON payloads for scripting or for testing and validating of the REST API for custom clients.
Describe alternatives you've considered
Currently you can curl
the Azure REST API, but you have to pass a lot of authentication context that will persist in your shell history, which can be a security concern. This would alleviate that and allow a user to interact with the raw REST API while letting the Azure CLI handle authentication contexts on behalf of the user.
Additional context
You can see a good example of this with the Cloud Foundry CLI, cf
. You can cf curl
to interact with raw API resources the CLI doesn't support out of the box.