title: What is the best way to maintain previous versions of an API in Azure?
body: <p>My goal is to have previous versions be <strong>immutable</strong>: they should not change in definition and function.
  The API is build with ASP.NET Core based on .NET 4.7.2(cause of dependencies) and hosted as Azure App Service.</p>
  
  <p>Preferably, I don't want to clutter my code by adding "version knowledge" to it. Also if the versions can be hosted under the same base URL that would be nice too.</p>
  
  <p>My research:</p>
  
  <ol>
  <li><a href="https://github.com/microsoft/aspnet-api-versioning" rel="nofollow noreferrer">ASP.NET API Versioning</a></li>
  </ol>
  
  <p>With this you have full control over versioning inside your application. But when a new version is released, all older versions are also updated and thus can change. This means you cannot mutate any existing function but have to create new versions, <a href="https://www.hanselman.com/blog/ASPNETCoreRESTfulWebAPIVersioningMadeEasy.aspx" rel="nofollow noreferrer">like Scott does in URL PATH SEGMENT VERSIONING</a>.</p>
  
  <ol start="2">
  <li><a href="https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots" rel="nofollow noreferrer">Azure Deploymentslots</a></li>
  </ol>
  
  <p>As the documentation explains, this should be used for staging. However this could also be used to 'store' your versions, since every deploymentslot is hosted without any relation to each other.</p>
  
  <ol start="3">
  <li><a href="https://docs.microsoft.com/en-us/azure/app-service/configure-common#configure-path-mappings" rel="nofollow noreferrer">Virtual Applications</a></li>
  </ol>
  
  <p>Hosting versions as virtual applications is also an option. However all settings of the App Service are shared between these virtual applications. Which means when changing any setting this will impact every version.</p>
  
  <ol start="4">
  <li><a href="https://docs.microsoft.com/en-us/azure/app-service/containers/tutorial-custom-docker-image" rel="nofollow noreferrer">Azure Web App for Containers</a></li>
  </ol>
  
  <p>My knowledge of this is limited, but from what I have read this is also an option. Creating images based on versions of your application, uploading these to an <a href="https://docs.microsoft.com/en-us/azure/container-registry/" rel="nofollow noreferrer">Azure Container Registery</a>. Then create an App Service for each version using these images.</p>