forked from Azure/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Storage from generation to main (Azure#26840)
* Move Storage to main * Update ChangeLog.md --------- Co-authored-by: Yabo Hu <[email protected]>
- Loading branch information
1 parent
31b4221
commit e7bc36e
Showing
187 changed files
with
5,783 additions
and
1,118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
208 changes: 208 additions & 0 deletions
208
src/Storage/Storage.Autorest/custom/Start-AzStorageAccountMigration.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
# ---------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code | ||
# is regenerated. | ||
# ---------------------------------------------------------------------------------- | ||
|
||
<# | ||
.Synopsis | ||
Account Migration request can be triggered for a storage account to change its redundancy level. | ||
The migration updates the non-zonal redundant storage account to a zonal redundant account or vice-versa in order to have better reliability and availability. | ||
Zone-redundant storage (ZRS) replicates your storage account synchronously across three Azure availability zones in the primary region. | ||
.Description | ||
Account Migration request can be triggered for a storage account to change its redundancy level. | ||
The migration updates the non-zonal redundant storage account to a zonal redundant account or vice-versa in order to have better reliability and availability. | ||
Zone-redundant storage (ZRS) replicates your storage account synchronously across three Azure availability zones in the primary region. | ||
.Example | ||
Start-AzStorageAccountMigration -AccountName myaccount -ResourceGroupName myresourcegroup -TargetSku Standard_LRS -Name migration1 -AsJob | ||
.Example | ||
Get-AzStorageAccount -ResourceGroupName myresourcegroup -Name myaccount | Start-AzStorageAccountMigration -TargetSku Standard_LRS -AsJob | ||
.Example | ||
$properties = '{ | ||
"properties": { | ||
"targetSkuName": "Standard_ZRS" | ||
} | ||
}' | ||
Start-AzStorageAccountMigration -ResourceGroupName myresourcegroup -AccountName myaccount -JsonString $properties -AsJob | ||
.Example | ||
# Before executing the cmdlet, make sure you have a json file that contains {"properties": {"targetSkuName": <TargetSKU>}} | ||
Start-AzStorageAccountMigration -ResourceGroupName myresourcegroup -AccountName myaccount -JsonFilePath properties.json -AsJob | ||
.Inputs | ||
Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IStorageIdentity | ||
.Outputs | ||
System.Boolean | ||
.Notes | ||
COMPLEX PARAMETER PROPERTIES | ||
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. | ||
INPUTOBJECT <IStorageIdentity>: Identity Parameter | ||
[AccountName <String>]: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. | ||
[BlobInventoryPolicyName <String>]: The name of the storage account blob inventory policy. It should always be 'default' | ||
[DeletedAccountName <String>]: Name of the deleted storage account. | ||
[EncryptionScopeName <String>]: The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. | ||
[Id <String>]: Resource identity path | ||
[Location <String>]: The location of the deleted storage account. | ||
[ManagementPolicyName <String>]: The name of the Storage Account Management Policy. It should always be 'default' | ||
[MigrationName <String>]: The name of the Storage Account Migration. It should always be 'default' | ||
[ObjectReplicationPolicyId <String>]: For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file. | ||
[PrivateEndpointConnectionName <String>]: The name of the private endpoint connection associated with the Azure resource | ||
[ResourceGroupName <String>]: The name of the resource group within the user's subscription. The name is case insensitive. | ||
[SubscriptionId <String>]: The ID of the target subscription. | ||
[Username <String>]: The name of local user. The username must contain lowercase letters and numbers only. It must be unique only within the storage account. | ||
.Link | ||
https://learn.microsoft.com/powershell/module/az.storage/start-azstorageaccountmigration | ||
#> | ||
function Start-AzStorageAccountMigration { | ||
[OutputType([System.Boolean])] | ||
[CmdletBinding(DefaultParameterSetName='CustomerExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] | ||
param( | ||
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)] | ||
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)] | ||
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')] | ||
[System.String] | ||
# The name of the storage account within the specified resource group. | ||
# Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. | ||
${AccountName}, | ||
|
||
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)] | ||
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)] | ||
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')] | ||
[System.String] | ||
# The name of the resource group within the user's subscription. | ||
# The name is case insensitive. | ||
${ResourceGroupName}, | ||
|
||
[Parameter(ParameterSetName='CustomerExpanded')] | ||
[Parameter(ParameterSetName='CustomerViaJsonFilePath')] | ||
[Parameter(ParameterSetName='CustomerViaJsonString')] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] | ||
[System.String] | ||
# The ID of the target subscription. | ||
${SubscriptionId}, | ||
|
||
[Parameter(ParameterSetName='CustomerViaIdentityExpanded', Mandatory, ValueFromPipeline)] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IStorageIdentity] | ||
# Identity Parameter | ||
${InputObject}, | ||
|
||
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)] | ||
[Parameter(ParameterSetName='CustomerViaIdentityExpanded', Mandatory)] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.PSArgumentCompleterAttribute("Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS")] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')] | ||
[System.String] | ||
# Target sku name for the account | ||
${TargetSku}, | ||
|
||
[Parameter(ParameterSetName='CustomerExpanded')] | ||
[Parameter(ParameterSetName='CustomerViaIdentityExpanded')] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')] | ||
[System.String] | ||
# current value is 'default' for customer initiated migration | ||
${Name}, | ||
|
||
[Parameter(ParameterSetName='CustomerExpanded')] | ||
[Parameter(ParameterSetName='CustomerViaIdentityExpanded')] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')] | ||
[System.String] | ||
# SrpAccountMigrationType in ARM contract which is 'accountMigrations' | ||
${Type}, | ||
|
||
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')] | ||
[System.String] | ||
# Path of Json file supplied to the Customer operation | ||
${JsonFilePath}, | ||
|
||
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')] | ||
[System.String] | ||
# Json string supplied to the Customer operation | ||
${JsonString}, | ||
|
||
[Parameter()] | ||
[Alias('AzureRMContext', 'AzureCredential')] | ||
[ValidateNotNull()] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Azure')] | ||
[System.Management.Automation.PSObject] | ||
# The DefaultProfile parameter is not functional. | ||
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. | ||
${DefaultProfile}, | ||
|
||
[Parameter()] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] | ||
[System.Management.Automation.SwitchParameter] | ||
# Run the command as a job | ||
${AsJob}, | ||
|
||
[Parameter(DontShow)] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] | ||
[System.Management.Automation.SwitchParameter] | ||
# Wait for .NET debugger to attach | ||
${Break}, | ||
|
||
[Parameter(DontShow)] | ||
[ValidateNotNull()] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.SendAsyncStep[]] | ||
# SendAsync Pipeline Steps to be appended to the front of the pipeline | ||
${HttpPipelineAppend}, | ||
|
||
[Parameter(DontShow)] | ||
[ValidateNotNull()] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.SendAsyncStep[]] | ||
# SendAsync Pipeline Steps to be prepended to the front of the pipeline | ||
${HttpPipelinePrepend}, | ||
|
||
[Parameter()] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] | ||
[System.Management.Automation.SwitchParameter] | ||
# Run the command asynchronously | ||
${NoWait}, | ||
|
||
[Parameter()] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] | ||
[System.Management.Automation.SwitchParameter] | ||
# Returns true when the command succeeds | ||
${PassThru}, | ||
|
||
[Parameter(DontShow)] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] | ||
[System.Uri] | ||
# The URI for the proxy server to use | ||
${Proxy}, | ||
|
||
[Parameter(DontShow)] | ||
[ValidateNotNull()] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] | ||
[System.Management.Automation.PSCredential] | ||
# Credentials for a proxy server to use for the remote call | ||
${ProxyCredential}, | ||
|
||
[Parameter(DontShow)] | ||
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] | ||
[System.Management.Automation.SwitchParameter] | ||
# Use the default credentials for the proxy | ||
${ProxyUseDefaultCredentials} | ||
) | ||
|
||
process { | ||
Write-Warning("After your request to convert the account’s redundancy configuration is validated, the conversion will typically complete in a few days, but can take a few weeks depending on current resource demands in the region, account size, and other factors. The conversion can’t be stopped after being initiated, and for accounts with geo redundancy a failover can’t be initiated while conversion is in progress. The data within the storage account will continue to be accessible with no loss of durability or availability.") | ||
Az.Storage.internal\Start-AzStorageAccountMigration @PSBoundParameters | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.