Application Error during deployment to an Azure Function Slot

86 views Asked by At

When I'm trying to deploy a code to Azure function slot in portal, the message appears in terminal VSCode

Error: :( Application ErrorIf you are the application administrator, you can access the <a style="color: grey"href="https://name_funcion-name_slot.scm.azurewebsites.net/detectors">diagnostic resources.

When i check the deployment logs this error appears:

{"Code":"BadRequest","Message":"Encountered an error (ServiceUnavailable) from host runtime.","Target":null,"Details":[{"Message":"Encountered an error (ServiceUnavailable) from host runtime."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","Message":"Encountered an error (ServiceUnavailable) from host runtime."}}],"Innererror":null}

I would like to understand where I should have permission to deploy in the slot, because I can deploy normally in production slot. Idk, maybe some error with runtime?!

1

There are 1 answers

0
Vivek Vaibhav Shandilya On

I created simple Http trigger and deployed to Azure function using Consumption plan.

This is how i deployed my function in new slot. This worked for me.

#My Code :

productionslot:

import azure.functions as func
import logging

app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)

@app.route(route="http_trigger")
def http_trigger(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')
    
    return func.HttpResponse(f"Hello, This HTTP triggered function executed successfully in Production slot")

newslot:

    return func.HttpResponse(f"Hello, This HTTP triggered function executed successfully in a new slot")

Add slot in Deployment slots:

  • Enable deployment slots.
  • Provide new name to slot.
  • click add enter image description here

enter image description here

To deploy to new slot from Vs Code:

  • select the new slot from the function. enter image description here

OUTPUT:

enter image description here

New Slot:

enter image description here

enter image description here