Azure 操作,例如自动缩放、通过 ftp 部署应用程序以及通过命令行交换

标签 azure

我是 Azure 平台的新人 我对此的了解非常有限。 我必须在 azure 平台上进行一些操作

  1. 自动扩展应用服务并监控此应用
  2. 通过 FTP 上传部署 Web 应用
  3. 添加和交换部署槽

    如何从命令行执行上述任务。

最佳答案

所有命令都可以在 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/

相关文章:

azure - 在 terraform 的 azure data explorer 中使用 eventhub 的默认消费者组

azure - 使用参数将 Azure 门户中内置的逻辑应用导入 Visual Studio

azure - 如果具有 DeployIfNotExist 效果的 Azure Policy 的范围是资源组,它是否能够部署资源?

python - 使用 Python 将文件夹上传到 Azure Blob

azure - 用于创建具有多个磁盘的 VM 的 ARM 模板

azure - 通过其他供应商购买的域名可以与从 Azure 购买的 SSL 证书一起使用吗?

azure - Azure 上集群的 DC/OS 扩展

php - 如何将 ADFS 2.x SAML token 发送到 Dynamics CRM 本地组织数据服务?

azure - 如何将我的 Luis.ai 应用程序的权限授予其他 Microsoft 帐户?

java - 无效_授权 : AADSTS50126: Error validating credentials due to invalid username or password