本文介绍 Azure Functions 挂载File share
参照文档Mount a file share to a Python function app:
关于Az webapp config storage-account add 的语法:
https://docs.microsoft.com/zh-cn/cli/azure/webapp/config/storage-account?view=azure-cli-latest
本文中用到的示例Python functions:
import logging
import os
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
result=os.path.exists("/app")
return func.HttpResponse(
str( result),
status_code=200
)
用到的文件共享示例脚本(“”中的内容需要替换):
az webapp config storage-account add --resource-group "sean-functions-demo" --name "func-demo-file-share" --custom-id "testfileshare" --storage-type AzureFiles --share-name "testfileshare" --account-name "seanfunctiondemostorage" --mount-path "/app" --access-key "p3FqhQQtA2Z48+5MJqJq0DBvC2oSY"
如果成功,则如下图所示: