如何通过 Azure CLI 为 azure devtest 实验室 VM 应用工件 "Run PowerShell"?
How to apply-artifact "Run PowerShell" for azure devtest lab VM by Azure CLI?
我有一个 PowerShell 脚本,想使用 az lab vm -apply-artifacts 将项目添加到 VM。谁能给我一个示例工件 Json 文件以及如何从 Azure CLI 调用它?
非常感谢!
give me an example artifact Json file and how to call it from Azure CLI?
以下示例显示了构成定义文件基本结构的部分:
{
"$schema": "https://raw.githubusercontent.com/Azure/azure-devtestlab/master/schemas/2016-11-28/dtlArtifacts.json",
"title": "",
"description": "",
"iconUri": "",
"targetOsType": "",
"parameters": {
"<parameterName>": {
"type": "",
"displayName": "",
"description": ""
}
},
"runCommand": {
"commandToExecute": ""
}
}
并且您可以获得示例 artifacts.json
定义文件。查看开发测试实验室团队在 GitHub repository.
中创建的工件
Apply artifacts 到 Azure 开发测试实验室中的虚拟机。
az lab vm apply-artifacts --artifacts '@artifacts.json' --lab-name MyLab --name MyVirtualMachine --resource-group MyResourceGroup
使用以下模板:
[
{
"artifactId": "/artifactSources/public repo/artifacts/windows-chocolatey",
"parameters": [
{
"name": "packages",
"value": "sqlserver-odbcdriver"
},
{
"name": "allowEmptyChecksums",
"value": "true"
},
{
"name": "ignoreChecksums",
"value": "false"
}
]
}
]
命令:
az lab vm apply-artifacts --artifacts "@AddChocolateyArtifact.json" --lab-name "DTL_Name" --name "VM_Name" --resource-group "RG_Name"
我有一个 PowerShell 脚本,想使用 az lab vm -apply-artifacts 将项目添加到 VM。谁能给我一个示例工件 Json 文件以及如何从 Azure CLI 调用它? 非常感谢!
give me an example artifact Json file and how to call it from Azure CLI?
以下示例显示了构成定义文件基本结构的部分:
{
"$schema": "https://raw.githubusercontent.com/Azure/azure-devtestlab/master/schemas/2016-11-28/dtlArtifacts.json",
"title": "",
"description": "",
"iconUri": "",
"targetOsType": "",
"parameters": {
"<parameterName>": {
"type": "",
"displayName": "",
"description": ""
}
},
"runCommand": {
"commandToExecute": ""
}
}
并且您可以获得示例 artifacts.json
定义文件。查看开发测试实验室团队在 GitHub repository.
Apply artifacts 到 Azure 开发测试实验室中的虚拟机。
az lab vm apply-artifacts --artifacts '@artifacts.json' --lab-name MyLab --name MyVirtualMachine --resource-group MyResourceGroup
使用以下模板:
[
{
"artifactId": "/artifactSources/public repo/artifacts/windows-chocolatey",
"parameters": [
{
"name": "packages",
"value": "sqlserver-odbcdriver"
},
{
"name": "allowEmptyChecksums",
"value": "true"
},
{
"name": "ignoreChecksums",
"value": "false"
}
]
}
]
命令:
az lab vm apply-artifacts --artifacts "@AddChocolateyArtifact.json" --lab-name "DTL_Name" --name "VM_Name" --resource-group "RG_Name"