microsoft / vscode-azurefunctions

Azure Functions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions
MIT License
291 stars 133 forks source link

How to publish Azure Function from VSCode NOT using storage key? #4304

Open frankchen76 opened 1 week ago

frankchen76 commented 1 week ago

After I disabled my storage account's "Storage account key access" setting for a company compliance, I cannot publish an Azure Function from VSCode via right click Func->click "deploy to function app" from Azure Function extension. it complained that "Key based authentication is not permitted on this storage account" which is understandable because this setting is disabled. I already configured my user account to access storage account via RBAC and Azure Function to access storage account using managed Id which work fine. But how can I tell Azure Function VSCode extension to use my account for deployment instead of using storage key used by default? I used a consumption plan based on a Linux host and Azure Function is developed by using a TypeScript template. Thanks

hossam-nasr commented 1 week ago

Hi @frankchen76 , thanks for bringing this to our attention! Could you share your Function App's local.settings.json file? Please sanitize any connection strings or identifying information before you do. Also, this storage account in question, is it being used for AzureWebJobsStorage or for some other storage binding?

frankchen76 commented 1 week ago

Hi @hossam-nasr, the AzureWebJobsStorage value is configured as a default value in local.settings.json. the default value is ok to connect to my local storage simulator. Do I need to update it? If I do, how to debug locally? Thanks


{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "node"
    }
}```