I was trying to import swagger json to APIM through the powershell command. its working for API which is hosted publicly with out any authentication ( ex : https://petstore3.swagger.io/api/v3/openapi.json ) , but when tried to access the swagger which behind AAD it always showing error. like below
Command executed :
$context = New-AzApiManagementContext -ResourceGroupName $resourceGroupName -ServiceName $apimServiceName
$Commonapi = Import-AzApiManagementApi -Context $context -SpecificationUrl $globalCatalog -SpecificationFormat OpenApi -Path $apiPath
Error getting :
Error Code: ValidationError Error Message: One or more fields contain incorrect values: Request Id: 78ee1174-074c-4b84-87ba-95f93313b055 Error Details: [Code= ValidationError, Message= Parsing
| error(s): Failed to import from specified resource https:fqdn/apipath/Swagger/v1/swagger.json: The remote name could not be resolved:
| 'aud-globalcatalog-kcwg11.dev.kpmg.com'., Target= representation]
So please help is there any other way to fix this ? or is there any way to update the command New-AzApiManagementContext to read the swager.json file kept in a local folder.