我是 Azure 平台的新人 我对此的了解非常有限。 我必须在 azure 平台上进行一些操作
- 自动扩展应用服务并监控此应用
- 通过 FTP 上传部署 Web 应用
添加和交换部署槽
如何从命令行执行上述任务。
最佳答案
所有命令都可以在 Azure CLI documentation
中找到。
<强> Autoscale app service and monitor application
az monitor autoscale create -g {myrg} --resource {resource-id} --min-count 2 --max-count 5 --count 3 --email-administrator
<强> Deploy Web App Through FTP Upload
#!/bin/bash
warurl=https://raw.githubusercontent.com/Azure-Samples/html-docs-hello-world/master/index.html
webappname=mywebapp$RANDOM
# Download sample static HTML page
curl $warurl --output index.html
# Create a resource group.
az group create --location westeurope --name myResourceGroup
# Create an App Service plan in `FREE` tier.
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku FREE
# Create a web app.
az webapp create --name $webappname --resource-group myResourceGroup --plan myAppServicePlan
# Get FTP publishing profile and query for publish URL and credentials
creds=($(az webapp deployment list-publishing-profiles --name $webappname --resource-group myResourceGroup \
--query "[?contains(publishMethod, 'FTP')].[publishUrl,userName,userPWD]" --output tsv))
# Use cURL to perform FTP upload. You can use any FTP tool to do this instead.
curl -T index.html -u ${creds[1]}:${creds[2]} ${creds[0]}/
# Copy the result of the following command into a browser to see the static HTML site.
echo http://$webappname.azurewebsites.net
<强> Adding and Swapping deployment slots
az webapp deployment slot auto-swap --slot
[--auto-swap-slot]
[--disable]
[--ids]
[--name]
[--resource-group]
[--subscription]
关于Azure 操作,例如自动缩放、通过 ftp 部署应用程序以及通过命令行交换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58594744/