when I am offline and not connected to Azure I cannot seem to debug an Azure function in Visual Studio Code.
What settings can I change in the launch.json to allow me to debug functions without connectivity?
when I am offline and not connected to Azure I cannot seem to debug an Azure function in Visual Studio Code.
What settings can I change in the launch.json to allow me to debug functions without connectivity?
Not Sure if you are using Python or PowerShell Azure Functions as nothing has been mentioned in the Question.
I have been working with both of the languages of Azure Functions in VS Code IDE.
As of now, checked with the latest Version of VS Code, Python Versions (3.9.x, 3.10.x) and PowerShell Azure Functions; they are working successfully in the debug mode.
I found the various causes and resolutions of the debugging process in Azure Functions in VS Code given by the user @HariKrishna, that will helps to fix your issue, refer to the SO #71532944
For PowerShell Azure Function, below is the code I have:
run.ps1:
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
Connect-AzAccount -Tenant '<your_Azure_Tenant_id' -SubscriptionId '<Your-Azure_Subscription_Id>'
Set-AzContext -Subscription "<Your-Azure_Subscription_Id>"
$body = "Hello Pravallika, This HTTP triggered function executed successfully."
# Associate values to output bindings by calling 'Push-OutputBinding'.
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $body
})
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "func start",
"type": "shell",
"command": "func start",
"problemMatcher": "$func-powershell-watch",
"isBackground": true
}
]
}
host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.3.0, 4.0.0)"
},
"managedDependency": {
"enabled": true
}
}
requirements.txt
file.local.settings.json
such as "AzureWebJobsStorage": "UseDevelopmentStorage=true"
.