Skip to content

[Feature]: Get-AzResourceGroup: Include createdTime and changedTime, at least optionally #27865

Open
@o-l-a-v

Description

@o-l-a-v

Description of the new feature

The ARM API supports $expand=createdTime,changedTime, both for GET and LIST for resource groups:

It'd be useful if Get-AzResourceGroup included this info, at least optionally. No possibility of that today:

Today one can do this:

# GET
ConvertFrom-Json -InputObject (
    (Invoke-AzRestMethod -Method 'Get' -Path (
        '{0}?$expand=createdTime,changedTime&api-version=2021-04-01' -f
        $ResourceGroupId
    )
).'Content'

# LIST
(
    ConvertFrom-Json -InputObject (
        Invoke-AzRestMethod -Method 'Get' -Path (
            '/subscriptions/resourceGroups?$expand=createdTime,changedTime&api-version=2021-04-01' -f
            $SubscriptionId
        )
    ).'Content'
).'value'

Proposed implementation details (optional)

Either:

  • Include by default.
  • Option to include said info.
    • Add -Expand someProperty,someOtherProperty option which translates to $expand=someProperty,someOtherProperty?
      • It's not that these change often, so can be hardcoded and checked before going to the ARM API?
        • "ERROR: "someProperty" is not a property that can be expanded on ResourceGroup.
    • -IncludeTimeInfo switch?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions