Using Locally with cURL

Preview

During Public Preview you can use the Team plan for free, and get an early-adopter discount at GA. Sign in

Using Locally with cURL

cURL supports Automatic Configuration, meaning that you can run it against Locally by prefixing any commands with locally run. When you do, if an Authorization header is not specified as a part of the cURL request then Locally will automatically add one for you.

For example, to list the Subscriptions available within the Control Plane, you can run:

$ locally run curl "https://localhost:5680/subscriptions?api-version=2023-07-01"

The same works against the Microsoft Graph endpoints - for example, to list the users in the Directory (Entra ID) emulator:

$ locally run curl "https://localhost:5679/v1.0/users"

The token Locally adds is for the API you're calling: Resource Manager gets a Resource Manager token, the Directory gets a Microsoft Graph token, and data planes such as Storage, Key Vault, App Configuration, Cosmos DB and Service Bus get a token for the account or vault in the URL. Your own app accepts tokens for its app registration, which the URL doesn't say, so pass its audience with --resource:

$ locally run --resource api://<client-id> curl "https://<app>.<domain>/api/orders"

A URL that isn't Locally's gets no token. If it's an Azure URL, such as https://management.azure.com/..., Locally refuses to send the request and prints the Locally URL to use instead. locally run az rest does the same.

You can toggle this behaviour in the Settings section of the Locally Dashboard to match the Azure API - see the Control Plane API documentation for more details.

Next steps

The Directory Emulator page covers what you can do with the Graph endpoint above, and the Azure CLI guide uses the same locally run prefix for az commands.

Preview

During Public Preview you can use the Team plan for free, and get an early-adopter discount at GA. Sign in

A local cloud for you and your AI agents.

Your Azure infrastructure, running on your machine. Deploy in seconds, break things freely, and ship to Azure when you're ready.