From 71206456e0e69fa5c0ea4720b18a6c9d06dd61ab Mon Sep 17 00:00:00 2001 From: Yifan Zhang Date: Mon, 30 Jan 2023 15:44:29 +0800 Subject: [PATCH] reformat help files and test --- .../help/Add-AzStorageAccountNetworkRule.md | 34 ++++++++----------- .../help/Close-AzStorageFileHandle.md | 20 +++++------ .../help/Copy-AzStorageBlob.md | 15 +++----- 3 files changed, 28 insertions(+), 41 deletions(-) diff --git a/src/Storage/Storage.Management/help/Add-AzStorageAccountNetworkRule.md b/src/Storage/Storage.Management/help/Add-AzStorageAccountNetworkRule.md index babeddcd82c7..0c52d6689cfa 100644 --- a/src/Storage/Storage.Management/help/Add-AzStorageAccountNetworkRule.md +++ b/src/Storage/Storage.Management/help/Add-AzStorageAccountNetworkRule.md @@ -58,51 +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. diff --git a/src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md b/src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md index 28b176e31967..6549da33252c 100644 --- a/src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md +++ b/src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md @@ -66,34 +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 - -``` +```powershell 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. diff --git a/src/Storage/Storage.Management/help/Copy-AzStorageBlob.md b/src/Storage/Storage.Management/help/Copy-AzStorageBlob.md index 5cd055a970af..21b067017803 100644 --- a/src/Storage/Storage.Management/help/Copy-AzStorageBlob.md +++ b/src/Storage/Storage.Management/help/Copy-AzStorageBlob.md @@ -42,16 +42,14 @@ 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" ``` @@ -59,8 +57,7 @@ $destBlob = $srcBlob | Copy-AzStorageBlob -DestContainer "destcontainername" - 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" ``` @@ -68,16 +65,14 @@ $destBlob = Copy-AzStorageBlob -AbsoluteUri $srcBlobUri -DestContainer "destcont 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 ```