Skip to content

Commit ce33904

Browse files
authored
[Storage] Fixed a sample script issue of set management policy with json (#13201)
1 parent 22d8cae commit ce33904

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/Storage/Storage.Management/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
* Changed the output of get/set Container/Share/Queue/Table access policy cmdlet, by change the child property Permission type from enum to String
2828
- `Get-AzStorageContainerStoredAccessPolicy`
2929
- `Set-AzStorageContainerStoredAccessPolicy`
30+
* Fixed a sample script issue of set management policy with json
31+
- `Set-AzStorageAccountManagementPolicy`
3032

3133
## Version 2.7.0
3234
* Supported enable/disable/get share soft delete properties on file Service of a Storage account

src/Storage/Storage.Management/Models/PSDataPolicy.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ public class PSDateAfterModification
263263
{
264264
public int DaysAfterModificationGreaterThan { get; set; }
265265

266+
public PSDateAfterModification()
267+
{ }
268+
266269
public PSDateAfterModification(int daysAfterModificationGreaterThan)
267270
{
268271
this.DaysAfterModificationGreaterThan = daysAfterModificationGreaterThan;
@@ -285,6 +288,9 @@ public class PSDateAfterCreation
285288
{
286289
public int DaysAfterCreationGreaterThan { get; set; }
287290

291+
public PSDateAfterCreation()
292+
{ }
293+
288294
public PSDateAfterCreation(int daysAfterCreationGreaterThan)
289295
{
290296
this.DaysAfterCreationGreaterThan = daysAfterCreationGreaterThan;

src/Storage/Storage.Management/help/Set-AzStorageAccountManagementPolicy.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,17 @@ This command first create 2 ManagementPolicy rule objects, then creates or updat
141141
```
142142
PS C:\>Set-AzStorageAccountManagementPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -Policy (@{
143143
Rules=(@{
144-
Enabled="true";
144+
Enabled=$true;
145145
Name="Test";
146146
Definition=(@{
147147
Actions=(@{
148148
BaseBlob=(@{
149-
TierToCool=30;
150-
TierToArchive=50;
151-
Delete=100;
149+
TierToCool=@{DaysAfterModificationGreaterThan=30};
150+
TierToArchive=@{DaysAfterModificationGreaterThan=50};
151+
Delete=@{DaysAfterModificationGreaterThan=100};
152152
});
153153
Snapshot=(@{
154-
Delete=100
154+
Delete=@{DaysAfterCreationGreaterThan=100};
155155
});
156156
});
157157
Filters=(@{
@@ -161,12 +161,12 @@ PS C:\>Set-AzStorageAccountManagementPolicy -ResourceGroupName "myresourcegroup"
161161
})
162162
},
163163
@{
164-
Enabled="false";
164+
Enabled=$false;
165165
Name="Test2";
166166
Definition=(@{
167167
Actions=(@{
168168
BaseBlob=(@{
169-
TierToCool=80;
169+
TierToCool=@{DaysAfterModificationGreaterThan=80};
170170
});
171171
});
172172
Filters=(@{
@@ -217,7 +217,7 @@ Rules : [
217217
}
218218
},
219219
{
220-
"Enabled": true,
220+
"Enabled": false,
221221
"Name": "Test2",
222222
"Definition": {
223223
"Actions": {

0 commit comments

Comments
 (0)