Skip to content

Commit

Permalink
update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanz7 committed Jan 30, 2023
1 parent 8af996f commit 93d7df9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,51 +58,45 @@ The **Add-AzStorageAccountNetworkRule** cmdlet adds IpRules or VirtualNetworkRul
## EXAMPLES

### Example 1: Add several IpRules with IPAddressOrRange
<!-- Skip: Output cannot be splitted from code -->
```
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
<!-- Skip: Output cannot be splitted from code -->
```
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
<!-- Skip: Output cannot be splitted from code -->
```
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
<!-- Skip: Output cannot be splitted from code -->
```
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
<!-- Skip: Output cannot be splitted from code -->
```
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
<!-- Skip: Output cannot be splitted from code -->
```
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
20 changes: 9 additions & 11 deletions src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<!-- Skip: Output cannot be splitted from code -->
```
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
<!-- Skip: Output cannot be splitted from code -->
```
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
<!-- Skip: Output cannot be splitted from code -->
```
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
15 changes: 5 additions & 10 deletions src/Storage/Storage.Management/help/Copy-AzStorageBlob.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,42 +42,37 @@ The **Copy-AzStorageBlob** cmdlet copies a blob synchronously, currently only su
## EXAMPLES

### Example 1: Copy a named blob to another
<!-- Skip: Output cannot be splitted from code -->
```
```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
<!-- Skip: Output cannot be splitted from code -->
```
```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
<!-- Skip: Output cannot be splitted from code -->
```
```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
<!-- Skip: Output cannot be splitted from code -->
```
```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
<!-- Skip: Output cannot be splitted from code -->
```
```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 @@ -71,8 +71,8 @@ The result has the same name and same relative position with regard to the other
For more information about script blocks, type `Get-Help about_Script_Blocks`.

### Example 3: Upload a local file to an Azure file, and perserve the local File SMB properties (File Attributtes, File Creation Time, File Last Write Time) in the Azure file.
```
PS C:\>Set-AzStorageFileContent -Source $localFilePath -ShareName sample -Path "dir1/file1" -PreserveSMBAttribute
```powershell
Set-AzStorageFileContent -Source $localFilePath -ShareName sample -Path "dir1/file1" -PreserveSMBAttribute
```

This example uploads a local file to an Azure file, and perserves the local File SMB properties (File Attributtes, File Creation Time, File Last Write Time) in the Azure file.
Expand Down

0 comments on commit 93d7df9

Please sign in to comment.