I have an Azure function app that uses api management service running locally. I created it with Visual Studio 2022. But when I try to publish it, everything looks good until this error appears.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========
Waiting for function app to be ready...
Finished waiting for function app to be ready
Starting to update your API
Failed to update your API in Azure (Status code: BadRequest).
The app is created under the resource group, but not the api management service. And analysis file was generated.
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Failed to update your API in Azure (Status code: BadRequest).
at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.EmitTerminatingError(String bucketName, String displayedErrorMessage, String loggedErrorMessage)
at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.<UpdateApiMApiInAzureAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WebTools.Azure.Publish.ApiMApi.FunctionAppApiMApiPublishHandler.FunctionApiMApiUpdater.<ImportSwaggerLinkToApiMAppAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WebTools.Azure.Publish.ApiMApi.FunctionAppApiMApiPublishHandler.FunctionApiMApiUpdater.<RunUpdateAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WebTools.Azure.Publish.ApiMApi.BaseApiMApiUpdater.<RunUpdateWithTelemetryAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WebTools.Azure.Publish.ApiMApi.FunctionAppApiMApiPublishHandler.<UpdateApiMApiAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WebTools.Azure.Functions.PublishProviders.AzureFunctionProfileVisual.<FunctionsAfterPostPublishAsync>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Publish.Framework.Nexus.PublishProfilesServiceImpl.ServerProjectProfilesManager.
<RunPublishTaskAsync>d__56.MoveNext()
===================
I also tried deleting everything and retrying, this time creating the api management service when I did the publish. The app was created as before, but the api management service was not created.



