|
25 | 25 | https://github.com/Azure/azure-powershell/blob/dev/documentation/breaking-changes/breaking-change-template.md
|
26 | 26 | -->
|
27 | 27 |
|
28 |
| -# Upcoming Breaking Changes |
| 28 | +# Upcoming Breaking Changes |
| 29 | + |
| 30 | +## Release 3.0.0 |
| 31 | + |
| 32 | + The following cmdlets were affected this release: |
| 33 | + |
| 34 | + **Get-AzureRmMetricDefinition** |
| 35 | + - The metric definitions are now retrieved from MDM. In this case, the records returned by this cmdlet are different even though the call remains the same. |
| 36 | + |
| 37 | + ```powershell |
| 38 | + # Old |
| 39 | + |
| 40 | + $s1 = Get-AzureRmMetricDefinition -res $resourceIdMetric -det |
| 41 | + write-host "Values: $s1" |
| 42 | + $s11 = $s1[0] |
| 43 | + write-host "First value: $s11" |
| 44 | + $metricName = $s11.Name |
| 45 | + |
| 46 | + $s2 = Get-AzureRmMetricDefinition -res $resourceIdMetric -met $metricName -det |
| 47 | + $s21 = $s2[0] |
| 48 | + write-host "Availabilities: $s21.MetricAvailabilities" |
| 49 | + |
| 50 | + write-host "Unit: $s21.Unit" |
| 51 | + write-host "ResourceId: $s21.ResourceId" |
| 52 | + write-host "Name: $s21.Name" |
| 53 | + write-host "PrimaryAggregationType: $s21.PrimaryAggregationType" |
| 54 | + write-host "Properties: $s21.Properties" |
| 55 | + |
| 56 | + $s22 = $s21.MetricAvailabilities[0] |
| 57 | + write-host "BlobLocation: $s22.BlobLocation" |
| 58 | + write-host "Location: $s22.Location" |
| 59 | + write-host "Retention: $s22.Retention" |
| 60 | + write-host "Timegrain: $s22.TimeGrain" |
| 61 | + |
| 62 | + # New |
| 63 | + |
| 64 | + # The call remains the same, but the returned values changed |
| 65 | + $s1 = Get-AzureRmMetricDefinition -res $resourceIdMetric -det |
| 66 | + write-host "Values: $s1" |
| 67 | + $s11 = $s1[0] |
| 68 | + write-host "First value: $s11" |
| 69 | + |
| 70 | + # Notice name is now a LocalizableString |
| 71 | + $metricName = $s11.Name.Value |
| 72 | + |
| 73 | + $s2 = Get-AzureRmMetricDefinition -res $resourceIdMetric -met $metricName -det |
| 74 | + $s21 = $s2[0] |
| 75 | + write-host "Availabilities: $s21.MetricAvailabilities" |
| 76 | + |
| 77 | + # Notice there are no properties and name is now a LocalizableString |
| 78 | + write-host "Unit: $s21.Unit" |
| 79 | + write-host "ResourceId: $s21.ResourceId" |
| 80 | + write-host "Name: $s21.Name.Value" |
| 81 | + write-host "PrimaryAggregationType: $s21.PrimaryAggregationType" |
| 82 | + |
| 83 | + # Notice there are no BlobLocation or Location |
| 84 | + $s22 = $s21.MetricAvailabilities[0] |
| 85 | + write-host "Retention: $s22.Retention" |
| 86 | + write-host "Timegrain: $s22.TimeGrain" |
| 87 | + |
| 88 | + ``` |
| 89 | + |
| 90 | + **Get-AzureRmMetric** |
| 91 | + - The metrics are now retrieved from MDM. The call and the returned records are different now. |
| 92 | + |
| 93 | + ```powershell |
| 94 | + # Old |
| 95 | + |
| 96 | + # The old syntax can be described this way: Get-AzureRmMEtric [-resourceid] string [-timeGrain] string [-detailedOutput] [-starttime string] [-endtime string] [-metricNames string [, string]*] |
| 97 | + # ResourceId and timeGrain are mandatory and positional |
| 98 | + # Other parameters are: StartTime (DateTime), EndTime (DateTime), MetricNames (array of strings), DetailedOutput (SwitchParameter). |
| 99 | + # All of them are optional. |
| 100 | + $s1 = Get-AzureRmMetric $resourceIdMetric $timeGrain -det |
| 101 | + |
| 102 | + write-host "Values: $s1" |
| 103 | + |
| 104 | + $s11 = $s1[0] |
| 105 | + |
| 106 | + write-host "Dimension name: $s11.DimensionName" |
| 107 | + write-host "Dimension value: $s11.DimensionValue" |
| 108 | + write-host "End time: $s11.EndTime" |
| 109 | + write-host "Start time: $s11.StartTime" |
| 110 | + write-host "ResourceId: $s11.ResourceId" |
| 111 | + write-host "TimeGrain: $s11.TimeGrain" |
| 112 | + write-host "Unit: $s11.Unit" |
| 113 | + write-host "Metric values: $s11.MetricValues" |
| 114 | + |
| 115 | + # New |
| 116 | + |
| 117 | + # The new syntax can be described as follows: Get-AzureRmMetric [-resourceId] string [[-metricNames] string [, string]* [-timeGrain string] [-starttime string] [-endtime string] [-aggregationType string]] [-detailedOutput] |
| 118 | + # ResourceId remians mandatory and positional (position 0) |
| 119 | + # All the other parameters are now optional, including timeGrain (hence this is a breaking change) |
| 120 | + # There is a new parameter AggregationType with this values (None (default), Average, Count, Minimum, Maximum, Total) |
| 121 | + # MetricNames, when given, is positional (position 1) and enables the other parameters: TimeGrain, StartTime, EndTime, AggregationType |
| 122 | + # |
| 123 | + # The following two calls are now valid since resourceId remains mandatory and positional |
| 124 | + $s1 = Get-AzureRmMetric $resourceIdMetric -det |
| 125 | + $s1 = Get-AzureRmMetric -res $resourceIdMetric -det |
| 126 | + |
| 127 | + write-host "Values: $s1" |
| 128 | + |
| 129 | + # This calls now requires the argument -MetricNames to succeed. MetricName is also positional (position 1). TimeGrain becomes optional and it is only accepted if MetricNames is given. |
| 130 | + # If metricName is not given, no other parameter is accepted (except resourceId) |
| 131 | + $s2 = Get-AzureRmMetric $resourceIdMetric $metricName -time $timeGrain -det |
| 132 | + $s2 = Get-AzureRmMetric $resourceIdMetric $metricName -time $timeGrain -det -aggreg Maximum |
| 133 | + |
| 134 | + write-host "Values: $s2" |
| 135 | + |
| 136 | + $s21 = $s2[0] |
| 137 | + |
| 138 | + # The output shows a different structure: the name is a localizable string, and metric values is now called Data. |
| 139 | + # The contents of Data depend on the value of AggregationType (if given). If not given Data will contain the values for the default aggregation type which depends on the metric and how it was defined. |
| 140 | + write-host "Name: $s21.Name.Value" |
| 141 | + write-host "Unit: $s21.Unit" |
| 142 | + write-host "Data: $s21.Data" |
| 143 | + |
| 144 | + ``` |
0 commit comments