azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzResourceGroupDeploymentWhatIfResult Json Output update for type placement

Open glloyd2010f opened this issue 5 years ago • 6 comments

Description of the new feature

Update the Json that is provided with the Get-AzResourceGroupDeploymentWhatIfResult command so that the type column isn't nested within the Before and After sections. Since a resource type would not likely change for a deployment having in each section is redundant.

    {
      "Scope": "/subscriptions/subscriptionId/resourceGroups/rgName",
      "RelativeResourceId": "microsoft.insights/components/applicationInsightsName",
      "FullyQualifiedResourceId": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/microsoft.insights/components/applicationInsightsName",
      "ChangeType": "Modify",
      "ApiVersion": "2018-05-01-preview",
      "Before": {
        "apiVersion": "2018-05-01-preview",
        "id": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Insights/components/applicationInsightsName",
        "kind": "web",
        "location": "eastus",
        "name": "applicationInsightsName",
        "properties": {
          "Application_Type": "web",
          "IngestionMode": "ApplicationInsights",
          "publicNetworkAccessForIngestion": "Enabled",
          "publicNetworkAccessForQuery": "Enabled",
          "RetentionInDays": 90
        },
        "tags": {
          "CreatedOnDate": "10/23/2020 16:02:10",
          "Domain": "SaaS Infrastructure Services"
        },
        "type": "microsoft.insights/components"      <-- Before.type
      },
      "After": {
        "apiVersion": "2018-05-01-preview",
        "id": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Insights/components/applicationInsightsName",
        "kind": "web",
        "location": "eastus",
        "name": "applicationInsightsName",
        "properties": {
          "Application_Type": "web",
          "Flow_Type": "Bluefield",
          "IngestionMode": "ApplicationInsights",
          "publicNetworkAccessForIngestion": "Enabled",
          "publicNetworkAccessForQuery": "Enabled",
          "Request_Source": "rest",
          "RetentionInDays": 60
        },
        "tags": {
          "CreatedOnDate": "10/23/2020 16:02:10",
          "Domain": "SaaS Infrastructure Services"
        },
        "type": "microsoft.insights/components"      <-- After.type
      },
      "Delta": [
        {
          "Path": "properties.RetentionInDays",
          "PropertyChangeType": "Modify",
          "Before": [],
          "After": [],
          "Children": null
        },
        {
          "Path": "properties.Flow_Type",
          "PropertyChangeType": "Create",
          "Before": null,
          "After": [],
          "Children": null
        },
        {
          "Path": "properties.Request_Source",
          "PropertyChangeType": "Create",
          "Before": null,
          "After": [],
          "Children": null
        }
      ]
    }

Proposed implementation details (optional)

Make a new entry of type/resourceType in the root of the "changes" object, this would be in addition to the Before.type and After.type sections. The addition of this instead of replacement would prevent a the addition of a breaking change to people that have automation around these output files. Idea of example output below.

   {
      "Scope": "/subscriptions/subscriptionId/resourceGroups/rgName",
      "RelativeResourceId": "microsoft.insights/components/applicationInsightsName",
      "FullyQualifiedResourceId": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/microsoft.insights/components/applicationInsightsName",
      "ChangeType": "Modify",
      "type/resourceType": "microsoft.insights/components",      <-- New Addition
      "ApiVersion": "2018-05-01-preview",
      "Before": {
        "apiVersion": "2018-05-01-preview",
        "id": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Insights/components/applicationInsightsName",
        "kind": "web",
        "location": "eastus",
        "name": "applicationInsightsName",
        "properties": {
          "Application_Type": "web",
          "IngestionMode": "ApplicationInsights",
          "publicNetworkAccessForIngestion": "Enabled",
          "publicNetworkAccessForQuery": "Enabled",
          "RetentionInDays": 90
        },
        "tags": {
          "CreatedOnDate": "10/23/2020 16:02:10",
          "Domain": "SaaS Infrastructure Services"
        },
        "type": "microsoft.insights/components"      <-- Before.type
      },
      "After": {
        "apiVersion": "2018-05-01-preview",
        "id": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Insights/components/applicationInsightsName",
        "kind": "web",
        "location": "eastus",
        "name": "applicationInsightsName",
        "properties": {
          "Application_Type": "web",
          "Flow_Type": "Bluefield",
          "IngestionMode": "ApplicationInsights",
          "publicNetworkAccessForIngestion": "Enabled",
          "publicNetworkAccessForQuery": "Enabled",
          "Request_Source": "rest",
          "RetentionInDays": 60
        },
        "tags": {
          "CreatedOnDate": "10/23/2020 16:02:10",
          "Domain": "SaaS Infrastructure Services"
        },
        "type": "microsoft.insights/components"      <-- After.type
      },
      "Delta": [
        {
          "Path": "properties.RetentionInDays",
          "PropertyChangeType": "Modify",
          "Before": [],
          "After": [],
          "Children": null
        },
        {
          "Path": "properties.Flow_Type",
          "PropertyChangeType": "Create",
          "Before": null,
          "After": [],
          "Children": null
        },
        {
          "Path": "properties.Request_Source",
          "PropertyChangeType": "Create",
          "Before": null,
          "After": [],
          "Children": null
        }
      ]
    }

glloyd2010f avatar Mar 11 '21 15:03 glloyd2010f

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure.

Issue Details

Description of the new feature

Update the Json that is provided with the Get-AzResourceGroupDeploymentWhatIfResult command so that the type column isn't nested within the Before and After sections. Since a resource type would not likely change for a deployment having in each section is redundant.

    {
      "Scope": "/subscriptions/subscriptionId/resourceGroups/rgName",
      "RelativeResourceId": "microsoft.insights/components/applicationInsightsName",
      "FullyQualifiedResourceId": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/microsoft.insights/components/applicationInsightsName",
      "ChangeType": "Modify",
      "ApiVersion": "2018-05-01-preview",
      "Before": {
        "apiVersion": "2018-05-01-preview",
        "id": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Insights/components/applicationInsightsName",
        "kind": "web",
        "location": "eastus",
        "name": "applicationInsightsName",
        "properties": {
          "Application_Type": "web",
          "IngestionMode": "ApplicationInsights",
          "publicNetworkAccessForIngestion": "Enabled",
          "publicNetworkAccessForQuery": "Enabled",
          "RetentionInDays": 90
        },
        "tags": {
          "CreatedOnDate": "10/23/2020 16:02:10",
          "Domain": "SaaS Infrastructure Services"
        },
        "type": "microsoft.insights/components"      <-- Before.type
      },
      "After": {
        "apiVersion": "2018-05-01-preview",
        "id": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Insights/components/applicationInsightsName",
        "kind": "web",
        "location": "eastus",
        "name": "applicationInsightsName",
        "properties": {
          "Application_Type": "web",
          "Flow_Type": "Bluefield",
          "IngestionMode": "ApplicationInsights",
          "publicNetworkAccessForIngestion": "Enabled",
          "publicNetworkAccessForQuery": "Enabled",
          "Request_Source": "rest",
          "RetentionInDays": 60
        },
        "tags": {
          "CreatedOnDate": "10/23/2020 16:02:10",
          "Domain": "SaaS Infrastructure Services"
        },
        "type": "microsoft.insights/components"      <-- After.type
      },
      "Delta": [
        {
          "Path": "properties.RetentionInDays",
          "PropertyChangeType": "Modify",
          "Before": [],
          "After": [],
          "Children": null
        },
        {
          "Path": "properties.Flow_Type",
          "PropertyChangeType": "Create",
          "Before": null,
          "After": [],
          "Children": null
        },
        {
          "Path": "properties.Request_Source",
          "PropertyChangeType": "Create",
          "Before": null,
          "After": [],
          "Children": null
        }
      ]
    }

Proposed implementation details (optional)

Make a new entry of type/resourceType in the root of the "changes" object, this would be in addition to the Before.type and After.type sections. The addition of this instead of replacement would prevent a the addition of a breaking change to people that have automation around these output files. Idea of example output below.

   {
      "Scope": "/subscriptions/subscriptionId/resourceGroups/rgName",
      "RelativeResourceId": "microsoft.insights/components/applicationInsightsName",
      "FullyQualifiedResourceId": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/microsoft.insights/components/applicationInsightsName",
      "ChangeType": "Modify",
      "type/resourceType": "microsoft.insights/components",      <-- New Addition
      "ApiVersion": "2018-05-01-preview",
      "Before": {
        "apiVersion": "2018-05-01-preview",
        "id": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Insights/components/applicationInsightsName",
        "kind": "web",
        "location": "eastus",
        "name": "applicationInsightsName",
        "properties": {
          "Application_Type": "web",
          "IngestionMode": "ApplicationInsights",
          "publicNetworkAccessForIngestion": "Enabled",
          "publicNetworkAccessForQuery": "Enabled",
          "RetentionInDays": 90
        },
        "tags": {
          "CreatedOnDate": "10/23/2020 16:02:10",
          "Domain": "SaaS Infrastructure Services"
        },
        "type": "microsoft.insights/components"      <-- Before.type
      },
      "After": {
        "apiVersion": "2018-05-01-preview",
        "id": "/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Insights/components/applicationInsightsName",
        "kind": "web",
        "location": "eastus",
        "name": "applicationInsightsName",
        "properties": {
          "Application_Type": "web",
          "Flow_Type": "Bluefield",
          "IngestionMode": "ApplicationInsights",
          "publicNetworkAccessForIngestion": "Enabled",
          "publicNetworkAccessForQuery": "Enabled",
          "Request_Source": "rest",
          "RetentionInDays": 60
        },
        "tags": {
          "CreatedOnDate": "10/23/2020 16:02:10",
          "Domain": "SaaS Infrastructure Services"
        },
        "type": "microsoft.insights/components"      <-- After.type
      },
      "Delta": [
        {
          "Path": "properties.RetentionInDays",
          "PropertyChangeType": "Modify",
          "Before": [],
          "After": [],
          "Children": null
        },
        {
          "Path": "properties.Flow_Type",
          "PropertyChangeType": "Create",
          "Before": null,
          "After": [],
          "Children": null
        },
        {
          "Path": "properties.Request_Source",
          "PropertyChangeType": "Create",
          "Before": null,
          "After": [],
          "Children": null
        }
      ]
    }
Author: glloyd2010f
Assignees: -
Labels:

ARM - Templates, Service Attention, customer-reported, feature-request, question

Milestone: -

ghost avatar Mar 14 '21 07:03 ghost

Any update on this?

glloyd2010f avatar Nov 15 '21 21:11 glloyd2010f

@glloyd2010f Apologies for the delay! we are looking into this, will help you with an update as soon as we get an update from the product owners.

@armleads-azure Can you please help us with an update? awaiting your response.

RakeshMohanMSFT avatar Mar 15 '22 07:03 RakeshMohanMSFT

Another question to tag with this, is there a way to get the "what if" results when leveraging 'New-AzResourceGroupDeployment -WhatIf' or 'New-AzDeployment -WhatIf'?? Or will we always need to run a secondary command?

glloyd2010f avatar Mar 15 '22 13:03 glloyd2010f

@glloyd2010f thank you for your response. Let me check that as well from our product team and get back to you. @armleads-azure Need your help here please

RakeshMohanMSFT avatar Mar 15 '22 13:03 RakeshMohanMSFT

This is a good suggestion, but it's a breaking change which requires a new API version. We'll add this to our team's backlog.

Another question to tag with this, is there a way to get the "what if" results when leveraging 'New-AzResourceGroupDeployment -WhatIf' or 'New-AzDeployment -WhatIf'?? Or will we always need to run a secondary command?

@glloyd2010f You can just use a variable to save the result:

$whatIfResult = New-AzResourceGroupDeployment -WhatIf ...

Closing the issue for now. Please let me know if there are any other questions.

shenglol avatar Mar 16 '22 20:03 shenglol