Skip to content

Commit 53a545e

Browse files
committed
Completing PowerShell and adding JSON.
1 parent ee7c006 commit 53a545e

File tree

3 files changed

+106
-13
lines changed

3 files changed

+106
-13
lines changed

articles/storage-mover/bandwidth-management.md

Lines changed: 106 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ Install-Module -Name Az.StorageMover -Scope CurrentUser -Repository PSGallery -F
107107
108108
```
109109
### Manage a bandwidth limit schedule
110-
111-
112110
```powershell
113-
114111
## Set variables
115112
$subscriptionID = "Your subscription ID"
116113
$resourceGroupName = "Your resource group name"
@@ -122,27 +119,123 @@ Connect-AzAccount -SubscriptionId $subscriptionID # -DeviceLogin #Leverage Devic
122119
123120
#------------
124121
# GET the schedule configured on an agent:
125-
$schedule = (Get-AzStorageMoverAgent -ResourceGroupName $resourceGroupName -StorageMoverName $storageMoverName -AgentName registeredAgentName).UploadLimitScheduleWeeklyRecurrence[0]
122+
$schedule = @(Get-AzStorageMoverAgent -ResourceGroupName $resourceGroupName -StorageMoverName $storageMoverName -AgentName registeredAgentName).UploadLimitScheduleWeeklyRecurrence
126123
# $schedule then contains a JSON structure with elements for each configured time windows and the upload limit in Mbps that applies during this window.
127124
128-
#------------
129-
# SET a new bandwidth limitation window on Monday and Tuesday:
130-
$timeblock = New-AzStorageMoverUploadLimitWeeklyRecurrenceObject `
125+
# Output the entire schedule
126+
$schedule
127+
128+
# Schedule elements can be addressed like an array.
129+
$schedule[0]
130+
```
131+
132+
#### Add a new bandwidth limitation
133+
```powershell
134+
$newLimit = New-AzStorageMoverUploadLimitWeeklyRecurrenceObject `
131135
-Day ["Monday", "Tuesday"] ` #Mandatory. An array, limited to the English names of all 7 days, Monday through Sunday in any order.
132136
-LimitInMbps 900 ` # Mandatory. limit in "Mega bits per second"
133137
-StartTimeHour 5 ` # Mandatory. 24-hour clock: 5 = 5am
134138
-EndTimeHour 17 ` # Mandatory. 24-hour clock: 17 = 5pm
135139
-EndTimeMinute 30 # Optional. Time blocks are precise to 30 Minutes. -EndTimeMinute 0 is equivalent to omitting the parameter. The only other acceptable value is the half hour mark: 30.
136140
137-
#TODO:
138-
#I need to see how to add a single new time block to an empty or existing schedule.
139-
#I need to see the best method of editing a schedule.
140-
#I need to see how I can delete a schedule.
141-
#
142-
#I would like to document the JSON schema through an annotated example schedule.
141+
# Updates the bandwidth limit schedule for the selected agent by adding the defined "time block" to the schedule.
142+
# Ensure that the new limit does not overlap with an already configured limit in the schedule, otherwise the operation will fail.
143+
Update-AzStorageMoverAgent `
144+
-ResourceGroupName resourceGroupName `
145+
-StorageMoverName storageMoverName `
146+
-AgentName registeredAgentName `
147+
-UploadLimitScheduleWeeklyRecurrence $newLimit
148+
# You can supply a comma-separated list of new limits. This action will add the new limit(s) to the schedule.
149+
# If there already are other limits defined, ensure the new limit's time span is not overlapping any of them. Otherwise, the operation will fail.
150+
```
143151

152+
#### Disable bandwidth limitation for an agent
153+
```powershell
154+
Update-AzStorageMoverAgent `
155+
-ResourceGroupName resourceGroupName `
156+
-StorageMoverName storageMoverName `
157+
-AgentName registeredAgentName `
158+
-UploadLimitScheduleWeeklyRecurrence [] # Supply an empty array to remove all previously configured limits. This operation cannot be undone. You have to build and supply a new schedule if you want to enable bandwidth limitations for this agent again.
144159
```
145160

161+
#### Change an existing bandwidth limitation
162+
You can combine the previously described management actions to selectively update an existing bandwidth limitation to a new limit or updated time span.
163+
164+
```powershell
165+
# Step 1: define the new limit object you want to use to replace an existing limit:
166+
$limit = New-AzStorageMoverUploadLimitWeeklyRecurrenceObject `
167+
-Day ["Monday", "Tuesday"] ` #Mandatory. An array, limited to the English names of all 7 days, Monday through Sunday in any order.
168+
-LimitInMbps 900 ` # Mandatory. limit in "Mega bits per second"
169+
-StartTimeHour 5 ` # Mandatory. 24-hour clock: 5 = 5am
170+
-EndTimeHour 17 ` # Mandatory. 24-hour clock: 17 = 5pm
171+
-EndTimeMinute 30 # Optional. Time blocks are precise to 30 Minutes. -EndTimeMinute 0 is equivalent to omitting the parameter. The only other acceptable value is the half hour mark: 30.
172+
173+
# Step 2: Find the bandwidth limitation window you wan to change:
174+
$schedule = @(Get-AzStorageMoverAgent -ResourceGroupName $resourceGroupName -StorageMoverName $storageMoverName -AgentName registeredAgentName).UploadLimitScheduleWeeklyRecurrence
175+
176+
$schedule[<n>] = $limit # Replace the limit (start count at zero) with your newly defined limit.
177+
178+
# Step 3: Remove any bandwidth limitations before you apply your updated schedule.
179+
# If you skip this step, step 4 will then try to append the new schedule to the old schedule. This will likely fail as overlapping time periods are specified.
180+
Update-AzStorageMoverAgent `
181+
-ResourceGroupName $resourceGroupName `
182+
-StorageMoverName $storageMoverName `
183+
-AgentName $registeredAgentName `
184+
-UploadLimitScheduleWeeklyRecurrence [] # Supply an empty array to remove all previously configured limits. This operation cannot be undone.
185+
186+
#Step 4: Update the bandwidth limit schedule for the selected agent:
187+
Update-AzStorageMoverAgent `
188+
-ResourceGroupName $resourceGroupName `
189+
-StorageMoverName $storageMoverName `
190+
-AgentName $registeredAgentName `
191+
-UploadLimitScheduleWeeklyRecurrence $schedule # Apply your entire, updated schedule. Performing this step on an agent with other limits already configured will try and append the new schedule. Ensure there are no overlapping time spans, otherwise the operation will fail.
192+
```
193+
## Understanding the JSON schema of the bandwidth limit schedule
194+
The bandwidth limit schedule is stored as a JSON construct in the property `UploadLimitScheduleWeeklyRecurrence` of a registered agent.
195+
196+
The [previous PowerShell section](#use-powershell-to-configure-a-bandwidth-limit-schedule) shows an example of how you can conveniently form and update this agent property by using Az PowerShell.
197+
You can, however, manually form that JSON and directly supply it as an argument for the property. The following section can help you understand the bandwidth schedule elements of this JSON construct.
198+
199+
> [!IMPORTANT]
200+
> The schedule consists of one or more time spans during which a bandwidth limit applies that the agent is not to exceed. These time spans must not be overlapping. At any given time, only one limit may apply. A JSON specifying a schedule with overlapping times is considered malformed and cannot be applied to the agent.
201+
202+
The following two representations of a bandwidth limit schedule are equivalent:
203+
:::image type="content" source="media/bandwidth-management/bandwidth-limit-json-small.png" alt-text="Azure portal dialog showing a calendar, similar to Outlook, with scheduled bandwidth limitation windows." lightbox="media/bandwidth-management/bandwidth-limit-json.png":::
204+
205+
```json
206+
{
207+
{
208+
"startTime":
209+
{
210+
"hour": 7,
211+
"minute": 0
212+
},
213+
"endTime":
214+
{
215+
"hour": 9,
216+
"minute": 0
217+
}
218+
"days": ["Monday"],
219+
"limitInMbps": 500
220+
},
221+
{
222+
"startTime":
223+
{
224+
"hour": 9,
225+
"minute": 0
226+
},
227+
"endTime":
228+
{
229+
"hour": 12,
230+
"minute": 0
231+
}
232+
"days": ["Monday", "Tuesday", "Wednesday"],
233+
"limitInMbps": 200
234+
}
235+
}
236+
```
237+
> [!NOTE]
238+
> Time spans not covered by an entry in the schedule allow the agent to utilize all available bandwidth. During these times, it is likely that and agent doesn't utilize all available bandwidth. You can find more details about that in the performance article, section: "[Why migration performance varies](performance-targets.md#why-migration-performance-varies)".
146239
147240
## Next steps
148241

8.57 KB
Loading
14.3 KB
Loading

0 commit comments

Comments
 (0)