AzureMysqlDeployment@1 - Azure Database for MySQL部署 v1 任务
使用此任务运行脚本,并在 Azure Database for MySQL 中对数据库进行更改。 Azure Database for MySQL 部署任务仅适用于 Azure Database for MySQL 单一服务器。
语法
# Azure Database for MySQL deployment v1
# Run your scripts and make changes to your Azure Database for MySQL.
- task: AzureMysqlDeployment@1
inputs:
azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure Subscription.
# DB Details
ServerName: # string. Required. Host Name.
#DatabaseName: # string. Database Name.
SqlUsername: # string. Required. Server Admin Login.
SqlPassword: # string. Required. Password.
# Deployment Package
#TaskNameSelector: 'SqlTaskFile' # 'SqlTaskFile' | 'InlineSqlTask'. Type. Default: SqlTaskFile.
SqlFile: # string. Required when TaskNameSelector = SqlTaskFile. MySQL Script.
#SqlInline: # string. Required when TaskNameSelector = InlineSqlTask. Inline MySQL Script.
#SqlAdditionalArguments: # string. Additional MySQL Arguments.
# Firewall
IpDetectionMethod: 'AutoDetect' # 'AutoDetect' | 'IPAddressRange'. Required. Specify Firewall Rules Using. Default: AutoDetect.
#StartIpAddress: # string. Required when IpDetectionMethod = IPAddressRange. Start IP Address.
#EndIpAddress: # string. Required when IpDetectionMethod = IPAddressRange. End IP Address.
#DeleteFirewallRule: true # boolean. Delete Rule After Task Ends. Default: true.
# Azure Database for MySQL Deployment v1
# Run your scripts and make changes to your Azure Database for MySQL.
- task: AzureMysqlDeployment@1
inputs:
azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure Subscription.
# DB Details
ServerName: # string. Required. Host Name.
#DatabaseName: # string. Database Name.
SqlUsername: # string. Required. Server Admin Login.
SqlPassword: # string. Required. Password.
# Deployment Package
#TaskNameSelector: 'SqlTaskFile' # 'SqlTaskFile' | 'InlineSqlTask'. Type. Default: SqlTaskFile.
SqlFile: # string. Required when TaskNameSelector = SqlTaskFile. MySQL Script.
#SqlInline: # string. Required when TaskNameSelector = InlineSqlTask. Inline MySQL Script.
#SqlAdditionalArguments: # string. Additional MySQL Arguments.
# Firewall
IpDetectionMethod: 'AutoDetect' # 'AutoDetect' | 'IPAddressRange'. Required. Specify Firewall Rules Using. Default: AutoDetect.
#StartIpAddress: # string. Required when IpDetectionMethod = IPAddressRange. Start IP Address.
#EndIpAddress: # string. Required when IpDetectionMethod = IPAddressRange. End IP Address.
#DeleteFirewallRule: true # boolean. Delete Rule After Task Ends. Default: true.
输入
azureSubscription
- Azure 订阅
输入别名: ConnectedServiceName
。 string
. 必需。
连接到 Azure 帐户需要此项。
若要配置新的服务连接,请从列表中选择 Azure 订阅,然后单击 。Authorize
如果未列出订阅,或者想要使用现有的服务主体,可以使用 或 Manage
按钮设置 Azure 服务连接Add
。
ServerName
- 主机名
string
. 必需。
Azure Database for MySQL 服务器的名称。
示例:fabrikam.mysql.database.azure.com
服务器名称在Azure Database for MySQL服务器资源的“概述”边栏选项卡上的Azure 门户中提供。
使用 MySQL Workbench 进行连接时,此值与 在 中使用的Hostname
Parameters
值相同。
DatabaseName
- 数据库名称
string
.
可选。 数据库的名称。 如果数据库名称不存在,该脚本将创建一个数据库名称。
如果未指定,请确保根据需要在提供的 SQL 文件或内联 SQL 中引用数据库。
注意:MySQL 数据库名称区分大小写。
SqlUsername
- 服务器管理员登录
string
. 必需。
Azure Database for MySQL 服务器支持本机 MySQL 身份验证。 可使用服务器的管理员登录名连接到服务器并进行身份验证。 示例:bbo1@fabrikam
。
使用 MySQL Workbench 进行连接时,此值与 在 中使用的Username
Parameters
值相同。
SqlPassword
- 密码
string
. 必需。
Azure Database for MySQL的管理员密码。 如果不记得密码,可以从Azure 门户更改密码。
可以使用管道中的变量定义此字符串。 示例:$(password)
。
此外,可以将变量类型 secret
标记为 来保护它。
TaskNameSelector
- 类型
string
. 允许的值: SqlTaskFile
(MySQL 脚本文件) 、 InlineSqlTask
(内联 MySQL 脚本) 。 默认值:SqlTaskFile
。
可选。 选择脚本文件 & 内联脚本之间的选项之一。
SqlTaskFile
(默认) ,用于SqlFile
参数InlineSqlTask
,用于与 参数一起使用SqlInline
。
注意:这些值区分大小写。
SqlFile
- MySQL 脚本
string
. 当 TaskNameSelector = SqlTaskFile
时,需要此选项。
自动化代理或自动化代理可访问的 UNC 路径上的脚本文件的完整路径。 例如:\BudgetIT\DeployBuilds\script.sql
。
可在此处使用预定义的系统变量(如 $(agent.releaseDirectory)
)和包含 SQL 语句的文件。
注意:MySQL 客户端首选 Unix 样式路径,因此从版本 1.183.0 开始,任务会将 Windows 样式路径转换为 Unix 样式路径。
示例:从 c:\foo\bar\myscript.sql
到 c:/foo/bar/myscript.sql
。
在 Linux 平台上使用该任务时,路径保持不变。 无需转义路径中的特殊字符。
SqlInline
- 内联 MySQL 脚本
string
. 当 TaskNameSelector = InlineSqlTask
时,需要此选项。
输入要对上面选择的数据库执行的 MySQL 脚本。
SqlAdditionalArguments
- 其他 MySQL 参数
string
.
可选。 MySQL 客户端支持的其他选项。 在Azure Database for MySQL上执行给定文件时,将应用这些选项。
示例:可以更改为默认制表符分隔的输出格式、HTML 甚至 XML 格式。 其他示例包括:
--comments
删除从客户端发送到服务器的注释。--quick
以防止结果缓存。--xml
将结果输出为 XML。
MySQL 客户端文档中介绍了所有可用选项。
IpDetectionMethod
- 使用 指定防火墙规则
string
. 必需。 允许的值:AutoDetect
、IPAddressRange
。 默认值:AutoDetect
。
若要成功执行任务,需要使管理员能够从自动化代理的 IP 地址访问 Azure Database for MySQL 服务器。
通过选择自动检测,可以自动为自动化代理的可能 IP 地址范围添加防火墙例外,也可以显式指定范围。
接受的值:
AutoDetect
自动检测自动化代理的公共 IP 地址。IPAddressRange
以显式指定要配置的 IP 地址范围。 使用StartIpAddress
和EndIpAddress
参数设置 IP 地址范围。
注意:这些值区分大小写。
StartIpAddress
- 起始 IP 地址
string
. 当 IpDetectionMethod = IPAddressRange
时,需要此选项。
自动化代理计算机池的起始 IP 地址。 例如:196.21.30.50
。
EndIpAddress
- 结束 IP 地址
string
. 当 IpDetectionMethod = IPAddressRange
时,需要此选项。
自动化代理计算机池的结束 IP 地址。 例如:196.21.30.65
。
DeleteFirewallRule
- 任务结束后删除规则
boolean
. 默认值:true
。
可选。 如果选择,将为相应的Azure Database for MySQL删除自动化代理的 IP 地址添加的异常。
任务控制选项
除了任务输入,所有任务都有控制选项。 有关详细信息,请参阅 控制选项和常见任务属性。
输出变量
无。
备注
使用此任务运行脚本,并在 Azure Database for MySQL 中对数据库进行更改。 请注意,这是预览版。 Azure Database for MySQL 部署任务仅适用于 Azure Database for MySQL 单一服务器。
要求
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈