Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

How to update/extend expirationDate of an existing DevTest lab VM that already has one set?

未关闭
#776 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
azure, powershell
领域
cloud

调研方向

从使用 Get-AzureRmResource 检索 VM 后报告的 Set-AzureRmResource 失败开始,并将 ARM 模板中的 SharedImageID 和 SharedImageVersion 与所需的 customImageId 和 galleryImageReference 属性进行比较。完成的标准是确定一种受支持的方式来更新 expirationDate,同时不会为 image 字段触发 MissingRequiredProperties 或 CannotSetProperty 错误。

由索引模型根据 Issue 内容生成。

描述

az.devtestlabs question

Hi,

Searching the internet we found some articles regarding how to use Azure PowerShell to extend a date on a lab VM for expiry.

Examples:

  1. https://github.com/Azure-Samples/virtual-machines-powershell-auto-expired/blob/master/README.md
  2. https://social.msdn.microsoft.com/Forums/azure/en-US/72034bf9-37c9-464e-8c2f-2ca9b9424a4c/how-to-change-or-postpone-a-vm-expiration-datetime-?forum=AzureDevTestLabs
  3. https://feedback.azure.com/forums/320373-lab-services/suggestions/34793482-postpone-expiration-date-for-individual-vms-if-nee
  4. https://azure.microsoft.com/en-gb/blog/set-expiration-date-for-vms-in-azure-devtest-labs/
    etc.

So, a lab user created a VM with 24 hr expiry and now wishes to keep it longer due to testing which has not concluded.
Whatever we try we just get the following error back on the Set-AzureRmResource command:

Set-AzureRmResource : MissingRequiredProperties : One of the following properties must be specified: customImageId, galleryImageReference.

Note our lab VM is created from an ARM template and from a lab attached shared image gallery (so a custom image in our private shared image gallery, not a public/marketplace image). As it's a private shared image gallery, it's not a true lab custom image either as such. So, in our ARM template we do not provide gallery reference or custom image ID, but more SharedImageID and SharedImageVersion.

We have tried to provide null values, or what we think may be suitable values for the "missing" properties but then we get error Set-AzureRmResource : CannotSetProperty : Cannot set or update property galleryImageReference. or Set-AzureRmResource : CannotSetProperty : Cannot set or update property customImageId.

Using AzureRm 6.13.1 but also tried Az in pwsh core and same issue.

Note that we get this error if we just get the VM object (using Get-AzureRmResource) change no properties and then set it back using Set-AzureRmResource.

Thanks!

主要语言
PowerShell
星标
465
派生
595
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Azure/azure-devtestlab 的其他 Issue

查看 Azure/azure-devtestlab 的全部 Issue

相似的 Issue

更多 Cloud Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。