![](/img/trans.png)
[英]Access Azure App Service backend from Azure Function using MobileServiceClient
[英]How to access Azure App Service folders from Function App
是否可以從 function 應用程序訪問 Azure 應用程序服務中的文件夾?
我在應用服務上部署了一個 web 應用程序,我需要從 function 應用程序訪問保存的文檔。
有可能嗎,如果可以,請 state。
You can have a try using Kudu rest api to access the folders in the Azure App Service from the function App. 請參閱下面的示例以通過 rest api 獲取文件。
$srcResGroupName = "ResGroupName"
$srcWebAppName = "WebAppName"
$filePath = "/site/wwwroot/myFolder/myfile.json"
# Get publishing profile for SOURCE application
$srcWebApp = Get-AzWebApp -Name $srcWebAppName -ResourceGroupName $srcResGroupName
[xml]$publishingProfile = Get-AzWebAppPublishingProfile -WebApp $srcWebApp
# Create Base64 authorization header
$username = $publishingProfile.publishData.publishProfile[0].userName
$password = $publishingProfile.publishData.publishProfile[0].userPWD
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$apiBaseUrl = "https://$($srcWebApp.Name).scm.azurewebsites.net/api/vfs"
# Download the saved file.
Invoke-RestMethod -Uri "$apiBaseUrl$($filePath)" `
-Headers @{UserAgent="powershell/1.0"; `
Authorization=("Basic {0}" -f $base64AuthInfo)} `
-Method GET `
-OutFile ./myfile.json
您可以查看此線程以獲取更多示例。
更新:
您可以查看此文檔以在 Azure 中創建 PowerShell function。
每隔一段時間在 powershell 腳本之上運行。 您需要為 Azure Functions 設置 Timer 觸發器。 請查看本教程。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.