[Feature]: OData API support for Az.ApiManagement module #25789
Open
Description
Description of the new feature
Currently, there is 0 support for doing anything with OData APIs in API Management with the Az module.
Even a simple Get-AzApiManagementApi does not fetch an existing OData API, let alone adding an OData based API.
The only way to do it currently is with the management API, adding an OData API like this:
$body = @{
properties = @{
format = "odata"
value = $ApiSpecification
path = $ApiName
displayName = $ApiDisplayName
serviceUrl = $ApiServiceUrl
protocols = @("https")
type = "odata"
}
}
$restApiUrl = "https://management.azure.com/subscriptions/$((Get-AzContext).Subscription.Id)/resourceGroups/$($ApiMgmtContext.ResourceGroupName)/providers/Microsoft.ApiManagement/service/$($ApiMgmtContext.ServiceName)/apis/$($ApiId)?import=true&api-version=2023-03-01-preview"
Invoke-AzRestMethod -Method Put -Uri $restApiUrl -Payload $($body | ConvertTo-Json -Depth 10)
Proposed implementation details (optional)
At least these functions should support OData APIs:
Get-AzApiManagementApi
New-AzApiManagementApi
Remove-AzApiManagementApi
Set-AzApiManagementApi
And all other API functions, not limited to:
New-AzApiManagementApiRelease
New-AzApiManagementApiRevision
Ideally, it should be supported in:
Import-AzApiManagementApi
But I understand that even in the resource manager interface, OData isn't really being imported, although it should make sense to do so.