Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] Fix help file format per static analysis result #20774

Merged
merged 8 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ The **Add-AzRmStorageContainerLegalHold** cmdlet adds legal hold tags to a Stora
## EXAMPLES

### Example 1: Add legal hold tags to a Storage blob container with Storage account name and container name
```
PS C:\>Add-AzRmStorageContainerLegalHold -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" -ContainerName "myContainer" -Tag tag1,tag2 -AllowProtectedAppendWriteAll $true
```powershell
Add-AzRmStorageContainerLegalHold -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" -ContainerName "myContainer" -Tag tag1,tag2 -AllowProtectedAppendWriteAll $true
```

This command adds legal hold tags to a Storage blob container with Storage account name and container name, and set AllowProtectedAppendWriteAll as true to allow append new blocks to append or block blob.

### Example 2: Add legal hold tags to a Storage blob container with Storage account object and container name
```
PS C:\>$accountObject = Get-AzStorageAccount -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount"
PS C:\>Add-AzRmStorageContainerLegalHold -StorageAccount $accountObject -ContainerName "myContainer" -Tag tag1
```powershell
$accountObject = Get-AzStorageAccount -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount"
Add-AzRmStorageContainerLegalHold -StorageAccount $accountObject -ContainerName "myContainer" -Tag tag1
```

This command adds legal hold tags to a Storage blob container with Storage account object and container name.

### Example 3: Add legal hold tags to all Storage blob containers in a Storage account with pipeline
```
PS C:\>Get-AzStorageAccount -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" | Add-AzRmStorageContainerLegalHold -Tag tag1,tag2,tag3
```powershell
Get-AzStorageAccount -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" | Add-AzRmStorageContainerLegalHold -Tag tag1,tag2,tag3
```

This command adds legal hold tags to all Storage blob containers in a Storage account with pipeline.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,45 +58,45 @@ The **Add-AzStorageAccountNetworkRule** cmdlet adds IpRules or VirtualNetworkRul
## EXAMPLES

### Example 1: Add several IpRules with IPAddressOrRange
```
PS C:\>Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount" -IPAddressOrRange "10.0.0.0/7","28.2.0.0/16"
```powershell
Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount" -IPAddressOrRange "10.0.0.0/7","28.2.0.0/16"
```

This command add several IpRules with IPAddressOrRange.

### Example 2: Add a VirtualNetworkRule with VirtualNetworkResourceID
```
PS C:\>$subnet = Get-AzVirtualNetwork -ResourceGroupName "myResourceGroup" -Name "myvirtualnetwork" | Get-AzVirtualNetworkSubnetConfig
PS C:\>Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount" -VirtualNetworkResourceId $subnet[0].Id
```powershell
$subnet = Get-AzVirtualNetwork -ResourceGroupName "myResourceGroup" -Name "myvirtualnetwork" | Get-AzVirtualNetworkSubnetConfig
Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount" -VirtualNetworkResourceId $subnet[0].Id
```

This command add a VirtualNetworkRule with VirtualNetworkResourceID.

### Example 3: Add VirtualNetworkRules with VirtualNetworkRule Objects from another account
```
PS C:\> $networkrule = Get-AzStorageAccountNetworkRuleSet -ResourceGroupName "myResourceGroup" -Name "mystorageaccount1"
PS C:\> Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount2" -VirtualNetworkRule $networkrule.VirtualNetworkRules
```powershell
$networkrule = Get-AzStorageAccountNetworkRuleSet -ResourceGroupName "myResourceGroup" -Name "mystorageaccount1"
Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount2" -VirtualNetworkRule $networkrule.VirtualNetworkRules
```

This command add VirtualNetworkRules with VirtualNetworkRule Objects from another account.

### Example 4: Add several IpRule with IpRule objects, input with JSON
```
PS C:\>Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount" -IPRule (@{IPAddressOrRange="10.0.0.0/7";Action="allow"},@{IPAddressOrRange="28.2.0.0/16";Action="allow"})
```powershell
Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount" -IPRule (@{IPAddressOrRange="10.0.0.0/7";Action="allow"},@{IPAddressOrRange="28.2.0.0/16";Action="allow"})
```

This command add several IpRule with IpRule objects, input with JSON.

### Example 5: Add a resource access rule
```
PS C:\>Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount" -TenantId $tenantId -ResourceId $ResourceId
```powershell
Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount" -TenantId $tenantId -ResourceId $ResourceId
```

This command adds a resource access rule with TenantId and ResourceId.

### Example 6: Add all resource access rules of one storage account to another storage account
```
PS C:\> (Get-AzStorageAccountNetworkRuleSet -ResourceGroupName "myResourceGroup" -Name "mystorageaccount1").ResourceAccessRules | Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount2"
```powershell
(Get-AzStorageAccountNetworkRuleSet -ResourceGroupName "myResourceGroup" -Name "mystorageaccount1").ResourceAccessRules | Add-AzStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "mystorageaccount2"
```

This command gets all resource access rules from one storage account, and adds them to another storage account.
Expand Down
17 changes: 9 additions & 8 deletions src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,31 +66,32 @@ The **Close-AzStorageFileHandle** cmdlet closes file handles of a file share, o
## EXAMPLES

### Example 1: Close all file handles on a file
```
PS C:\> Close-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2/test.txt' -CloseAll
```powershell
Close-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2/test.txt' -CloseAll
```

This command closes all file handles on a file.

### Example 2: Close all file handles which is opened 1 day ago on a file directory
```
PS C:\> Get-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2' -Recursive | Where-Object {$_.OpenTime.DateTime.AddDays(1) -lt (Get-Date)} | Close-AzStorageFileHandle -ShareName "mysharename"
```powershell
Get-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2' -Recursive | Where-Object {$_.OpenTime.DateTime.AddDays(1) -lt (Get-Date)} | Close-AzStorageFileHandle -ShareName "mysharename"
```

This command lists all file handles on a file directory recursively, filters out the handles which are opened 1 day ago, and then closes them.

### Example 3: Close all file handles on a file directory recursively and show the closed file handle count
<!-- Skip: Output cannot be splitted from code -->
```powershell
Close-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2' -Recursive -CloseAll -PassThru
```
PS C:\> Close-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2' -Recursive -CloseAll -PassThru
```output
10
```

This command closes all file handles on a file directory and shows the closed file handle count.

### Example 4: Close all file handles on a file share
```
PS C:\> Close-AzStorageFileHandle -ShareName "mysharename" -CloseAll -Recursive
```powershell
Close-AzStorageFileHandle -ShareName "mysharename" -CloseAll -Recursive
```

This command closes all file handles on a specific file share recursively.
Expand Down
10 changes: 5 additions & 5 deletions src/Storage/Storage.Management/help/Copy-AzStorageBlob.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,37 +42,37 @@ The **Copy-AzStorageBlob** cmdlet copies a blob synchronously, currently only su
## EXAMPLES

### Example 1: Copy a named blob to another
```
```powershell
$destBlob = Copy-AzStorageBlob -SrcContainer "sourcecontainername" -SrcBlob "srcblobname" -DestContainer "destcontainername" -DestBlob "destblobname"
```

This command copies a blob from source container to the destination container with a new blob name.

### Example 2: Copy blob from a blob object
```
```powershell
$srcBlob = Get-AzStorageBlob -Container $containerName -Blob $blobName -Context $ctx
$destBlob = $srcBlob | Copy-AzStorageBlob -DestContainer "destcontainername" -DestBlob "destblobname"
```

This command copies a blob from source blob object to the destination container with a new blob name.

### Example 3: Copy blob from a blob Uri
```
```powershell
$srcBlobUri = New-AzStorageBlobSASToken -Container $srcContainerName -Blob $srcBlobName -Permission rt -ExpiryTime (Get-Date).AddDays(7) -FullUri
$destBlob = Copy-AzStorageBlob -AbsoluteUri $srcBlobUri -DestContainer "destcontainername" -DestBlob "destblobname"
```

The first command creates a blob Uri of the source blob, with sas token of permission "rt". The second command copies from source blob Uri to the destination blob.

### Example 4: Update a block blob encryption scope
```
```powershell
$blob = Copy-AzStorageBlob -SrcContainer $containerName -SrcBlob $blobname -DestContainer $containername -EncryptionScope $newScopeName -Force
```

This command update a block blob encryption scope by copy it to itself with a new encryption scope.

### Example 5: Copy a blob to a new append blob
```
```powershell
$srcBlob = Get-AzStorageBlob -Container $containerName -Blob $blobName -Context $ctx
$destBlob = Copy-AzStorageBlob -SrcContainer "sourcecontainername" -SrcBlob "srcblobname" -DestContainer "destcontainername" -DestBlob "destblobname" -DestBlobType "Append" -DestContext $destCtx
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ The **Disable-AzStorageBlobDeleteRetentionPolicy** cmdlet disables delete retent

## EXAMPLES

### Example 1: Disable delete retention policy for the Blob service
<!-- Skip: Output cannot be splitted from code -->
### Example 1: Disable delete retention policy for the Blob services
```powershell
Disable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -PassThru
```
C:\PS>Disable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -PassThru

```output
Enabled Days
------- ----
False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ The **Disable-AzStorageBlobDeleteRetentionPolicy** cmdlet disables delete retent
## EXAMPLES

### Example 1: Disable last access time tracking for the Blob service
```
C:\PS>Disable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount"
```powershell
Disable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount"
```

This command disables last access time tracking for the Blob service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The **Disable-AzStorageBlobRestorePolicy** cmdlet disables Blob Restore Policy f

### Example 1: Disables Blob Restore Policy for the Azure Storage Blob service on a Storage account
```powershell
PS C:\> Disable-AzStorageBlobRestorePolicy -ResourceGroupName "myresourcegoup" -StorageAccountName "mystorageaccount"
Disable-AzStorageBlobRestorePolicy -ResourceGroupName "myresourcegoup" -StorageAccountName "mystorageaccount"
```

This command Disables Blob Restore Policy for the Azure Storage Blob service on a Storage account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ The **Disable-AzStorageContainerDeleteRetentionPolicy** cmdlet disables delete r
## EXAMPLES

### Example 1: Disable delete retention policy for blob containers
<!-- Skip: Output cannot be splitted from code -->
```powershell
Disable-AzStorageContainerDeleteRetentionPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -PassThru
```
C:\PS>Disable-AzStorageContainerDeleteRetentionPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -PassThru

```output
Enabled Days
------- ----
False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ The **Disable-AzStorageDeleteRetentionPolicy** cmdlet disables delete retention
## EXAMPLES

### Example 1: Disable delete retention policy for the Blob service
```
C:\PS>Disable-AzStorageDeleteRetentionPolicy
```powershell
Disable-AzStorageDeleteRetentionPolicy
```

This command disables delete retention policy for the Blob service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ The **Disable-AzStorageStaticWebsite** cmdlet disables static website for the Az
## EXAMPLES

### Example 1: Disable static website for a Azure Storage account
```
C:\PS>Disable-AzStorageStaticWebsite
```powershell
Disable-AzStorageStaticWebsite
```

This command disables static website for a Azure Storage account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ The **Enable-AzStorageBlobDeleteRetentionPolicy** cmdlet enables delete retentio
## EXAMPLES

### Example 1: Enable delete retention policy for the Blob service
<!-- Skip: Output cannot be splitted from code -->
```powershell
Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -AllowPermanentDelete -PassThru -RetentionDays 4
```
C:\PS>Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -AllowPermanentDelete -PassThru -RetentionDays 4

```output
Enabled Days AllowPermanentDelete
------- ---- --------------------
True 4 True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ The **Enable-AzStorageBlobLastAccessTimeTracking** cmdlet enables last access ti
## EXAMPLES

### Example 1: Enable last access time tracking for the Blob service
<!-- Skip: Output cannot be splitted from code -->
```powershell
Enable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -PassThru
```
C:\PS>Enable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -PassThru

```output
Enable Name TrackingGranularityInDays BlobType
------ ---- ------------------------- --------
True AccessTimeTracking 1 {blockBlob}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ The **Enable-AzStorageContainerDeleteRetentionPolicy** cmdlet enables delete ret
## EXAMPLES

### Example 1: Enable delete retention policy for Blob containers
<!-- Skip: Output cannot be splitted from code -->
```powershell
Enable-AzStorageContainerDeleteRetentionPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -PassThru -RetentionDays 3
```
C:\PS>Enable-AzStorageContainerDeleteRetentionPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -PassThru -RetentionDays 3

```output
Enabled Days
------- ----
True 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ The **Enable-AzStorageDeleteRetentionPolicy** cmdlet enables delete retention po
## EXAMPLES

### Example 1: Enable delete retention policy for the Blob service
```
C:\PS>Enable-AzStorageDeleteRetentionPolicy -RetentionDays 3
```powershell
Enable-AzStorageDeleteRetentionPolicy -RetentionDays 3
```

This command enables delete retention policy for the Blob service, and set deleted blob retention days to 3.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ The **Enable-AzStorageStaticWebsite** cmdlet enables static website for the Azur
## EXAMPLES

### Example 1: Enable static website for the Azure Storage account
```
C:\PS>Enable-AzStorageStaticWebsite -IndexDocument $indexdoc -ErrorDocument404Path $errordoc
```powershell
Enable-AzStorageStaticWebsite -IndexDocument $indexdoc -ErrorDocument404Path $errordoc
```

This command enables static website for the Azure Storage account.
Expand Down
24 changes: 13 additions & 11 deletions src/Storage/Storage.Management/help/Get-AzDataLakeGen2ChildItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ This cmdlet only works if Hierarchical Namespace is enabled for the Storage acco
## EXAMPLES

### Example 1: List the direct sub items from a Filesystem
<!-- Skip: Output cannot be splitted from code -->
```powershell
Get-AzDataLakeGen2ChildItem -FileSystem "filesystem1"
```
PS C:\>Get-AzDataLakeGen2ChildItem -FileSystem "filesystem1"

```output
FileSystem Name: filesystem1

Path IsDirectory Length LastModified Permissions Owner Group
Expand All @@ -40,10 +41,11 @@ dir2 True 2020-03-23 09:28:36Z rwxr-x---
This command lists the direct sub items from a Filesystem

### Example 2: List recursively from a directory, and fetch Properties/ACL
<!-- Skip: Output cannot be splitted from code -->
```powershell
Get-AzDataLakeGen2ChildItem -FileSystem "filesystem1" -Path "dir1/" -Recurse -FetchProperty
```
PS C:\>Get-AzDataLakeGen2ChildItem -FileSystem "filesystem1" -Path "dir1/" -Recurse -FetchProperty

```output
FileSystem Name: filesystem1

Path IsDirectory Length LastModified Permissions Owner Group
Expand All @@ -56,20 +58,20 @@ dir1/testfile_1K_0 False 1024 2020-03-23 09:29:21Z rw-r-----
This command lists the direct sub items from a Filesystem

### Example 3: List items recursively from a Filesystem in multiple batches
```
PS C:\> $MaxReturn = 1000
PS C:\> $FileSystemName = "filesystem1"
PS C:\> $Total = 0
PS C:\> $Token = $Null
PS C:\> do
```powershell
$MaxReturn = 1000
$FileSystemName = "filesystem1"
$Total = 0
$Token = $Null
do
{
$items = Get-AzDataLakeGen2ChildItem -FileSystem $FileSystemName -Recurse -MaxCount $MaxReturn -ContinuationToken $Token
$Total += $items.Count
if($items.Length -le 0) { Break;}
$Token = $items[$items.Count -1].ContinuationToken;
}
While ($null -ne $Token)
PS C:\> Echo "Total $Total items in Filesystem $FileSystemName"
Echo "Total $Total items in Filesystem $FileSystemName"
```

This example uses the *MaxCount* and *ContinuationToken* parameters to list items recursively from a Filesystem in multiple batches.
Expand Down
6 changes: 3 additions & 3 deletions src/Storage/Storage.Management/help/Get-AzDataLakeGen2Item.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ AccessTierChangedOn : 1/1/0001 12:00:00 AM +00:00
This command gets a directory from a Filesystem, and show the details.

### Example 2: Get a file from a Filesystem
<!-- Skip: Output cannot be splitted from code -->
```powershell
Get-AzDataLakeGen2Item -FileSystem "filesystem1" -Path "dir1/file1"
```
PS C:\> Get-AzDataLakeGen2Item -FileSystem "filesystem1" -Path "dir1/file1"

```output
FileSystem Name: filesystem1

Path IsDirectory Length LastModified Permissions Owner Group
Expand Down
Loading