如何使用 Az powershell 模块将存储挂载到应用程序服务
How to mount storage to app service using Az powershell module
我是运行下面的命令
az webapp config storage-account add -g appxxx-dfpg-dev2-web-eastus2 --name appxxx-dfpg-dev2-web-eastus2-backoffice-apsvc --storage-type AzureBlob --share-name central-imports-dev4 --access-key XXXXXXXXXXXXXXXXXXX== -a appxxxdfpgg --mount-path /central-imports -i CentralImports
而且效果很好。
我如何使用 Az powershell 模块实现相同的结果,我想我需要使用 Az.Websites 模块。
您正在寻找的是 New-AzWebAppAzureStoragePath
命令,用它来创建 Azure 存储路径,然后使用 Set-AzWebApp
更新 Web 应用程序。
样本:
$storagePath1 = New-AzWebAppAzureStoragePath -Name "RemoteStorageAccount1" -AccountName "myaccount.files.core.windows.net" -Type AzureFiles -ShareName "someShareName" -AccessKey "some access key"
-MountPath "C:\myFolderInsideTheContainerWebApp"
$storagePath2 = New-AzWebAppAzureStoragePath -Name "RemoteStorageAccount2" -AccountName "myaccount2.files.core.windows.net" -Type AzureFiles -ShareName "someShareName2" -AccessKey "some access key 2"
-MountPath "C:\myFolderInsideTheContainerWebApp2"
Set-AzWebApp -ResourceGroup myresourcegroup -Name myapp -AzureStoragePath $storagepath1, $storagePath2
我是运行下面的命令
az webapp config storage-account add -g appxxx-dfpg-dev2-web-eastus2 --name appxxx-dfpg-dev2-web-eastus2-backoffice-apsvc --storage-type AzureBlob --share-name central-imports-dev4 --access-key XXXXXXXXXXXXXXXXXXX== -a appxxxdfpgg --mount-path /central-imports -i CentralImports
而且效果很好。 我如何使用 Az powershell 模块实现相同的结果,我想我需要使用 Az.Websites 模块。
您正在寻找的是 New-AzWebAppAzureStoragePath
命令,用它来创建 Azure 存储路径,然后使用 Set-AzWebApp
更新 Web 应用程序。
样本:
$storagePath1 = New-AzWebAppAzureStoragePath -Name "RemoteStorageAccount1" -AccountName "myaccount.files.core.windows.net" -Type AzureFiles -ShareName "someShareName" -AccessKey "some access key"
-MountPath "C:\myFolderInsideTheContainerWebApp"
$storagePath2 = New-AzWebAppAzureStoragePath -Name "RemoteStorageAccount2" -AccountName "myaccount2.files.core.windows.net" -Type AzureFiles -ShareName "someShareName2" -AccessKey "some access key 2"
-MountPath "C:\myFolderInsideTheContainerWebApp2"
Set-AzWebApp -ResourceGroup myresourcegroup -Name myapp -AzureStoragePath $storagepath1, $storagePath2