diff --git a/src/DataMigration/DataMigration.Autorest/Az.DataMigration.psd1 b/src/DataMigration/DataMigration.Autorest/Az.DataMigration.psd1 index b1cf5d0571ba..84a906cc6056 100644 --- a/src/DataMigration/DataMigration.Autorest/Az.DataMigration.psd1 +++ b/src/DataMigration/DataMigration.Autorest/Az.DataMigration.psd1 @@ -11,7 +11,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.DataMigration.private.dll' FormatsToProcess = './Az.DataMigration.format.ps1xml' - FunctionsToExport = 'Get-AzDataMigrationAssessment', 'Get-AzDataMigrationPerformanceDataCollection', 'Get-AzDataMigrationSkuRecommendation', 'Get-AzDataMigrationSqlService', 'Get-AzDataMigrationSqlServiceAuthKey', 'Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric', 'Get-AzDataMigrationSqlServiceMigration', 'Get-AzDataMigrationToSqlManagedInstance', 'Get-AzDataMigrationToSqlVM', 'Invoke-AzDataMigrationCutoverToSqlManagedInstance', 'Invoke-AzDataMigrationCutoverToSqlVM', 'New-AzDataMigrationSqlService', 'New-AzDataMigrationSqlServiceAuthKey', 'New-AzDataMigrationToSqlManagedInstance', 'New-AzDataMigrationToSqlVM', 'Register-AzDataMigrationIntegrationRuntime', 'Remove-AzDataMigrationSqlService', 'Remove-AzDataMigrationSqlServiceNode', 'Stop-AzDataMigrationToSqlManagedInstance', 'Stop-AzDataMigrationToSqlVM', 'Update-AzDataMigrationSqlService', '*' + FunctionsToExport = 'Get-AzDataMigrationAssessment', 'Get-AzDataMigrationPerformanceDataCollection', 'Get-AzDataMigrationSkuRecommendation', 'Get-AzDataMigrationSqlService', 'Get-AzDataMigrationSqlServiceAuthKey', 'Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric', 'Get-AzDataMigrationSqlServiceMigration', 'Get-AzDataMigrationToSqlDb', 'Get-AzDataMigrationToSqlManagedInstance', 'Get-AzDataMigrationToSqlVM', 'Invoke-AzDataMigrationCutoverToSqlManagedInstance', 'Invoke-AzDataMigrationCutoverToSqlVM', 'New-AzDataMigrationSqlService', 'New-AzDataMigrationSqlServiceAuthKey', 'New-AzDataMigrationToSqlDb', 'New-AzDataMigrationToSqlManagedInstance', 'New-AzDataMigrationToSqlVM', 'Register-AzDataMigrationIntegrationRuntime', 'Remove-AzDataMigrationSqlService', 'Remove-AzDataMigrationSqlServiceNode', 'Remove-AzDataMigrationToSqlDb', 'Stop-AzDataMigrationToSqlDb', 'Stop-AzDataMigrationToSqlManagedInstance', 'Stop-AzDataMigrationToSqlVM', 'Update-AzDataMigrationSqlService', '*' AliasesToExport = '*' PrivateData = @{ PSData = @{ diff --git a/src/DataMigration/DataMigration.Autorest/custom/Cmdlets/Get-AzDataMigrationPerformanceDataCollection.ps1 b/src/DataMigration/DataMigration.Autorest/custom/Cmdlets/Get-AzDataMigrationPerformanceDataCollection.ps1 index 1c77dc18ddc5..f1b67bb4468b 100644 --- a/src/DataMigration/DataMigration.Autorest/custom/Cmdlets/Get-AzDataMigrationPerformanceDataCollection.ps1 +++ b/src/DataMigration/DataMigration.Autorest/custom/Cmdlets/Get-AzDataMigrationPerformanceDataCollection.ps1 @@ -146,4 +146,3 @@ function Get-AzDataMigrationPerformanceDataCollection } } - diff --git a/src/DataMigration/DataMigration.Autorest/custom/readme.md b/src/DataMigration/DataMigration.Autorest/custom/readme.md index 3be76f74060b..0c59b6988bd9 100644 --- a/src/DataMigration/DataMigration.Autorest/custom/readme.md +++ b/src/DataMigration/DataMigration.Autorest/custom/readme.md @@ -12,7 +12,7 @@ For `Az.DataMigration` to use custom cmdlets, it does this two different ways. W For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.DataMigration.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. -For script cmdlets, these are loaded via the `Az.DataMigration.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. +For script cmdlets, these are loaded via the `Az.DataMigration.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. ## Purpose This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. @@ -32,10 +32,10 @@ These provide functionality to our HTTP pipeline and other useful features. In s ### Attributes For processing the cmdlets, we've created some additional attributes: - `Microsoft.Azure.PowerShell.Cmdlets.DataMigration.DescriptionAttribute` - - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. - `Microsoft.Azure.PowerShell.Cmdlets.DataMigration.DoNotExportAttribute` - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.DataMigration`. - `Microsoft.Azure.PowerShell.Cmdlets.DataMigration.InternalExportAttribute` - - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.DataMigration`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder. + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.DataMigration`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder. - `Microsoft.Azure.PowerShell.Cmdlets.DataMigration.ProfileAttribute` - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/DataMigration/DataMigration.Autorest/docs/Az.DataMigration.md b/src/DataMigration/DataMigration.Autorest/docs/Az.DataMigration.md index 51c01452b479..f702410e10a7 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Az.DataMigration.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Az.DataMigration.md @@ -32,6 +32,9 @@ Retrieve the registered Integration Runtime nodes and their monitoring data for ### [Get-AzDataMigrationSqlServiceMigration](Get-AzDataMigrationSqlServiceMigration.md) Retrieve the List of database migrations attached to the service. +### [Get-AzDataMigrationToSqlDb](Get-AzDataMigrationToSqlDb.md) +Retrieve the specified database migration for a given SQL Db. + ### [Get-AzDataMigrationToSqlManagedInstance](Get-AzDataMigrationToSqlManagedInstance.md) Retrieve the specified database migration for a given SQL Managed Instance. @@ -50,6 +53,9 @@ Create or Update Database Migration Service. ### [New-AzDataMigrationSqlServiceAuthKey](New-AzDataMigrationSqlServiceAuthKey.md) Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime. +### [New-AzDataMigrationToSqlDb](New-AzDataMigrationToSqlDb.md) +Create a new database migration to a given SQL Db. + ### [New-AzDataMigrationToSqlManagedInstance](New-AzDataMigrationToSqlManagedInstance.md) Create a new database migration to a given SQL Managed Instance. @@ -65,6 +71,12 @@ Delete Database Migration Service. ### [Remove-AzDataMigrationSqlServiceNode](Remove-AzDataMigrationSqlServiceNode.md) Delete the integration runtime node. +### [Remove-AzDataMigrationToSqlDb](Remove-AzDataMigrationToSqlDb.md) +Remove the specified database migration for a given SQL Db. + +### [Stop-AzDataMigrationToSqlDb](Stop-AzDataMigrationToSqlDb.md) +Stop in-progress database migration to SQL Db. + ### [Stop-AzDataMigrationToSqlManagedInstance](Stop-AzDataMigrationToSqlManagedInstance.md) Stop in-progress database migration to SQL Managed Instance. diff --git a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlService.md b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlService.md index 379a7cb66017..bf93cd4e0d01 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlService.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlService.md @@ -186,7 +186,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.ISqlMigrationService +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.ISqlMigrationService ## NOTES @@ -201,6 +201,7 @@ INPUTOBJECT : Identity Parameter - `[Id ]`: Resource identity path - `[ManagedInstanceName ]`: - `[ResourceGroupName ]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SqlDbInstanceName ]`: - `[SqlMigrationServiceName ]`: Name of the SQL Migration Service. - `[SqlVirtualMachineName ]`: - `[SubscriptionId ]`: Subscription ID that identifies an Azure subscription. diff --git a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceAuthKey.md b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceAuthKey.md index 4465776c18e0..a0ba96cae260 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceAuthKey.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceAuthKey.md @@ -152,7 +152,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.IAuthenticationKeys +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IAuthenticationKeys ## NOTES diff --git a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric.md b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric.md index 5c2a1b99e5f8..031ca5e348a3 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric.md @@ -167,7 +167,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.IIntegrationRuntimeMonitoringData +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IIntegrationRuntimeMonitoringData ## NOTES diff --git a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceMigration.md b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceMigration.md index 5cefa9d8d92a..45f47a5fb696 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceMigration.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationSqlServiceMigration.md @@ -122,7 +122,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.IDatabaseMigration +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IDatabaseMigration ## NOTES diff --git a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlDb.md b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlDb.md new file mode 100644 index 000000000000..701fac3cdab7 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlDb.md @@ -0,0 +1,230 @@ +--- +external help file: +Module Name: Az.DataMigration +online version: https://docs.microsoft.com/powershell/module/az.datamigration/get-azdatamigrationtosqldb +schema: 2.0.0 +--- + +# Get-AzDataMigrationToSqlDb + +## SYNOPSIS +Retrieve the specified database migration for a given SQL Db. + +## SYNTAX + +### Get (Default) +``` +Get-AzDataMigrationToSqlDb -ResourceGroupName -SqlDbInstanceName -TargetDbName + [-SubscriptionId ] [-Expand ] [-MigrationOperationId ] [-DefaultProfile ] + [-PassThru] [] +``` + +### GetViaIdentity +``` +Get-AzDataMigrationToSqlDb -InputObject [-Expand ] + [-MigrationOperationId ] [-DefaultProfile ] [-PassThru] [] +``` + +## DESCRIPTION +Retrieve the specified database migration for a given SQL Db. + +## EXAMPLES + +### Example 1: Get the details of a given Database Migration to a SQL DB +```powershell +Get-AzDataMigrationToSqlDb -ResourceGroupName "myRG" -SqlDbInstanceName "mySqlDb" -TargetDbName "mydb1" +``` + +```output +Name Kind ProvisioningState MigrationStatus +---- ---- ----------------- --------------- +mydb1 SqlDb Succeeded InProgress +``` + +Get the details of a given Database Migration to a SQL DB + +### Example 2: Get the expanded details of a given Database Migration to a SQL DB +```powershell +$dbMigration = Get-AzDataMigrationToSqlDb -ResourceGroupName "myRG" -SqlDbInstanceName "mySqlDb" -TargetDbName "mydb1" -Expand MigrationStatusDetails +$dbMigration.MigrationStatusDetailMigrationState +``` + +```output +MonitorMigration +``` + +Get the expanded details of a given Database Migration to a SQL DB + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Expand +Complete migration details be included in the response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.IDataMigrationIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationOperationId +Optional migration operation ID. +If this is provided, then details of migration operation for that ID are retrieved. +If not provided (default), then details related to most recent or current operation are retrieved. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SqlDbInstanceName +. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription ID that identifies an Azure subscription. + +```yaml +Type: System.String[] +Parameter Sets: Get +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetDbName +The name of the target database. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.IDataMigrationIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IDatabaseMigrationSqlDb + +## NOTES + +ALIASES + +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 : Identity Parameter + - `[Id ]`: Resource identity path + - `[ManagedInstanceName ]`: + - `[ResourceGroupName ]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SqlDbInstanceName ]`: + - `[SqlMigrationServiceName ]`: Name of the SQL Migration Service. + - `[SqlVirtualMachineName ]`: + - `[SubscriptionId ]`: Subscription ID that identifies an Azure subscription. + - `[TargetDbName ]`: The name of the target database. + +## RELATED LINKS + diff --git a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlManagedInstance.md b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlManagedInstance.md index 0f5e34fb1791..f256e5a7fd5f 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlManagedInstance.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlManagedInstance.md @@ -75,7 +75,7 @@ Accept wildcard characters: False ``` ### -Expand -The child resources to include in the response. +Complete migration details be included in the response. ```yaml Type: System.String @@ -207,7 +207,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.IDatabaseMigrationSqlMi +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IDatabaseMigrationSqlMi ## NOTES @@ -222,6 +222,7 @@ INPUTOBJECT : Identity Parameter - `[Id ]`: Resource identity path - `[ManagedInstanceName ]`: - `[ResourceGroupName ]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SqlDbInstanceName ]`: - `[SqlMigrationServiceName ]`: Name of the SQL Migration Service. - `[SqlVirtualMachineName ]`: - `[SubscriptionId ]`: Subscription ID that identifies an Azure subscription. diff --git a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlVM.md b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlVM.md index cafbb60db977..7f14abdfc103 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlVM.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Get-AzDataMigrationToSqlVM.md @@ -75,7 +75,7 @@ Accept wildcard characters: False ``` ### -Expand -The child resources to include in the response. +Complete migration details be included in the response. ```yaml Type: System.String @@ -207,7 +207,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.IDatabaseMigrationSqlVM +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IDatabaseMigrationSqlVM ## NOTES @@ -222,6 +222,7 @@ INPUTOBJECT : Identity Parameter - `[Id ]`: Resource identity path - `[ManagedInstanceName ]`: - `[ResourceGroupName ]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SqlDbInstanceName ]`: - `[SqlMigrationServiceName ]`: Name of the SQL Migration Service. - `[SqlVirtualMachineName ]`: - `[SubscriptionId ]`: Subscription ID that identifies an Azure subscription. diff --git a/src/DataMigration/DataMigration.Autorest/docs/Invoke-AzDataMigrationCutoverToSqlManagedInstance.md b/src/DataMigration/DataMigration.Autorest/docs/Invoke-AzDataMigrationCutoverToSqlManagedInstance.md index 71b543b82fd8..e5e9f96d66db 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Invoke-AzDataMigrationCutoverToSqlManagedInstance.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Invoke-AzDataMigrationCutoverToSqlManagedInstance.md @@ -14,8 +14,8 @@ Initiate cutover for in-progress online database migration to SQL Managed Instan ``` Invoke-AzDataMigrationCutoverToSqlManagedInstance -ManagedInstanceName -ResourceGroupName - -TargetDbName [-SubscriptionId ] [-MigrationOperationId ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] + -TargetDbName -MigrationOperationId [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] ``` ## DESCRIPTION @@ -93,7 +93,7 @@ Type: System.String Parameter Sets: (All) Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False diff --git a/src/DataMigration/DataMigration.Autorest/docs/Invoke-AzDataMigrationCutoverToSqlVM.md b/src/DataMigration/DataMigration.Autorest/docs/Invoke-AzDataMigrationCutoverToSqlVM.md index efa0d84773aa..33fa41f8d69f 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Invoke-AzDataMigrationCutoverToSqlVM.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Invoke-AzDataMigrationCutoverToSqlVM.md @@ -14,8 +14,8 @@ Initiate cutover for in-progress online database migration to SQL VM. ``` Invoke-AzDataMigrationCutoverToSqlVM -ResourceGroupName -SqlVirtualMachineName - -TargetDbName [-SubscriptionId ] [-MigrationOperationId ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] + -TargetDbName -MigrationOperationId [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] ``` ## DESCRIPTION @@ -78,7 +78,7 @@ Type: System.String Parameter Sets: (All) Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False diff --git a/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationSqlService.md b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationSqlService.md index cb0a13759f48..3968d8f1fe82 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationSqlService.md +++ b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationSqlService.md @@ -212,7 +212,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.ISqlMigrationService +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.ISqlMigrationService ## NOTES diff --git a/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationSqlServiceAuthKey.md b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationSqlServiceAuthKey.md index 2752f95fffc7..7cd39a326298 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationSqlServiceAuthKey.md +++ b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationSqlServiceAuthKey.md @@ -198,7 +198,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.IRegenAuthKeys +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IRegenAuthKeys ## NOTES diff --git a/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlDb.md b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlDb.md new file mode 100644 index 000000000000..14f28260a9aa --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlDb.md @@ -0,0 +1,497 @@ +--- +external help file: +Module Name: Az.DataMigration +online version: https://docs.microsoft.com/powershell/module/az.datamigration/new-azdatamigrationtosqldb +schema: 2.0.0 +--- + +# New-AzDataMigrationToSqlDb + +## SYNOPSIS +Create a new database migration to a given SQL Db. + +## SYNTAX + +``` +New-AzDataMigrationToSqlDb -ResourceGroupName -SqlDbInstanceName -TargetDbName + [-SubscriptionId ] [-Kind ] [-MigrationService ] [-Scope ] + [-SourceDatabaseName ] [-SourceSqlConnectionAuthentication ] + [-SourceSqlConnectionDataSource ] [-SourceSqlConnectionEncryptConnection] + [-SourceSqlConnectionPassword ] [-SourceSqlConnectionTrustServerCertificate] + [-SourceSqlConnectionUserName ] [-TableList ] [-TargetDatabaseCollation ] + [-TargetSqlConnectionAuthentication ] [-TargetSqlConnectionDataSource ] + [-TargetSqlConnectionEncryptConnection] [-TargetSqlConnectionPassword ] + [-TargetSqlConnectionTrustServerCertificate] [-TargetSqlConnectionUserName ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create a new database migration to a given SQL Db. + +## EXAMPLES + +### Example 1: Start a Database Migration from the on-premise Source Sql Server to target Sql Db +```powershell +New-AzDataMigrationToSqlDb -ResourceGroupName myRG -SqlDbInstanceName "mysqldb" -MigrationService "/subscriptions/1111-2222-3333-4444/resourceGroups/myRG/providers/Microsoft.DataMigration/SqlMigrationServices/myDMS" -TargetSqlConnectionAuthentication "SqlAuthentication" -TargetSqlConnectionDataSource "mydb.windows.net" -TargetSqlConnectionPassword "pass" -TargetSqlConnectionUserName "user" -SourceSqlConnectionAuthentication "SqlAuthentication" -SourceSqlConnectionDataSource "xyz.MICROSOFT.COM" -SourceSqlConnectionUserName "user1" -SourceSqlConnectionPassword "password" -SourceDatabaseName "sourcedb" -TargetDbName "mydb1" -Scope "/subscriptions/1111-2222-3333-4444/resourceGroups/myRG/providers/Microsoft.Sql/servers/mysqldb" +``` + +```output +Name Kind ProvisioningState MigrationStatus +----- ---- ----------------- --------------- +mydb1 SqlDb Succeeded InProgress +``` + +Start a Database Migration from the on-premise Source Sql Server to target Sql Db + +### Example 2: Start a Database Migration with some selcted tables from the on-premise Source Sql Server to target Sql Db +```powershell +New-AzDataMigrationToSqlDb -ResourceGroupName myRG -SqlDbInstanceName "mysqldb" -MigrationService "/subscriptions/1111-2222-3333-4444/resourceGroups/myRG/providers/Microsoft.DataMigration/SqlMigrationServices/myDMS" -TargetSqlConnectionAuthentication "SqlAuthentication" -TargetSqlConnectionDataSource "mydb.windows.net" -TargetSqlConnectionPassword "pass" -TargetSqlConnectionUserName "user" -SourceSqlConnectionAuthentication "SqlAuthentication" -SourceSqlConnectionDataSource "xyz.MICROSOFT.COM" -SourceSqlConnectionUserName "user1" -SourceSqlConnectionPassword "password" -SourceDatabaseName "sourcedb" -TargetDbName "mydb1" -Scope "/subscriptions/1111-2222-3333-4444/resourceGroups/myRG/providers/Microsoft.Sql/servers/mysqldb" -TableList "table_1" +``` + +```output +Name Kind ProvisioningState MigrationStatus +----- ---- ----------------- --------------- +mydb1 SqlDb Succeeded InProgress +``` + +Start a Database Migration with some selcted tables from the on-premise Source Sql Server to target Sql Db + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Kind +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Support.ResourceType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MigrationService +Resource Id of the Migration Service. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scope +Resource Id of the target resource (SQL VM or SQL Managed Instance) + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceDatabaseName +Name of the source database. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceSqlConnectionAuthentication +Authentication type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceSqlConnectionDataSource +Data source. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceSqlConnectionEncryptConnection +Whether to encrypt connection or not. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceSqlConnectionPassword +Password to connect to source SQL. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceSqlConnectionTrustServerCertificate +Whether to trust server certificate or not. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceSqlConnectionUserName +User name to connect to source SQL. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SqlDbInstanceName +. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription ID that identifies an Azure subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TableList +List of tables to copy. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetDatabaseCollation +Database collation to be used for the target database. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetDbName +The name of the target database. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetSqlConnectionAuthentication +Authentication type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetSqlConnectionDataSource +Data source. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetSqlConnectionEncryptConnection +Whether to encrypt connection or not. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetSqlConnectionPassword +Password to connect to source SQL. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetSqlConnectionTrustServerCertificate +Whether to trust server certificate or not. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetSqlConnectionUserName +User name to connect to source SQL. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IDatabaseMigrationSqlDb + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlManagedInstance.md b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlManagedInstance.md index 289e826a2fec..e6254c15312e 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlManagedInstance.md +++ b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlManagedInstance.md @@ -16,12 +16,11 @@ Create a new database migration to a given SQL Managed Instance. New-AzDataMigrationToSqlManagedInstance -ManagedInstanceName -ResourceGroupName -TargetDbName [-SubscriptionId ] [-AzureBlobAccountKey ] [-AzureBlobContainerName ] [-AzureBlobStorageAccountResourceId ] - [-FileSharePassword ] [-FileSharePath ] [-FileShareUsername ] [-Kind ] - [-MigrationOperationId ] [-MigrationService ] [-Offline] - [-OfflineConfigurationLastBackupName ] [-ProvisioningError ] [-Scope ] - [-SourceDatabaseName ] [-SourceSqlConnectionAuthentication ] + [-FileSharePassword ] [-FileSharePath ] [-FileShareUsername ] + [-Kind ] [-MigrationService ] [-Offline] [-OfflineConfigurationLastBackupName ] + [-Scope ] [-SourceDatabaseName ] [-SourceSqlConnectionAuthentication ] [-SourceSqlConnectionDataSource ] [-SourceSqlConnectionEncryptConnection] - [-SourceSqlConnectionPassword ] [-SourceSqlConnectionTrustServerCertificate] + [-SourceSqlConnectionPassword ] [-SourceSqlConnectionTrustServerCertificate] [-SourceSqlConnectionUserName ] [-StorageAccountKey ] [-StorageAccountResourceId ] [-TargetDatabaseCollation ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] @@ -128,7 +127,7 @@ Accept wildcard characters: False Password for username to access file share location. ```yaml -Type: System.String +Type: System.Security.SecureString Parameter Sets: (All) Aliases: @@ -199,21 +198,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -MigrationOperationId -ID tracking current migration operation. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -MigrationService Resource Id of the Migration Service. @@ -291,21 +275,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProvisioningError -Error message for migration provisioning failure, if any. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ResourceGroupName Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @@ -401,7 +370,7 @@ Accept wildcard characters: False Password to connect to source SQL. ```yaml -Type: System.String +Type: System.Security.SecureString Parameter Sets: (All) Aliases: @@ -555,7 +524,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.IDatabaseMigrationSqlMi +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IDatabaseMigrationSqlMi ## NOTES diff --git a/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlVM.md b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlVM.md index 286754f70180..648f611a10e5 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlVM.md +++ b/src/DataMigration/DataMigration.Autorest/docs/New-AzDataMigrationToSqlVM.md @@ -15,12 +15,11 @@ Create a new database migration to a given SQL VM. ``` New-AzDataMigrationToSqlVM -ResourceGroupName -SqlVirtualMachineName -TargetDbName [-SubscriptionId ] [-AzureBlobAccountKey ] [-AzureBlobContainerName ] - [-AzureBlobStorageAccountResourceId ] [-FileSharePassword ] [-FileSharePath ] - [-FileShareUsername ] [-Kind ] [-MigrationOperationId ] - [-MigrationService ] [-Offline] [-OfflineConfigurationLastBackupName ] - [-ProvisioningError ] [-Scope ] [-SourceDatabaseName ] + [-AzureBlobStorageAccountResourceId ] [-FileSharePassword ] [-FileSharePath ] + [-FileShareUsername ] [-Kind ] [-MigrationService ] [-Offline] + [-OfflineConfigurationLastBackupName ] [-Scope ] [-SourceDatabaseName ] [-SourceSqlConnectionAuthentication ] [-SourceSqlConnectionDataSource ] - [-SourceSqlConnectionEncryptConnection] [-SourceSqlConnectionPassword ] + [-SourceSqlConnectionEncryptConnection] [-SourceSqlConnectionPassword ] [-SourceSqlConnectionTrustServerCertificate] [-SourceSqlConnectionUserName ] [-StorageAccountKey ] [-StorageAccountResourceId ] [-TargetDatabaseCollation ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] @@ -46,6 +45,10 @@ This command starts a Database Migration from the Source Sql Server to target Sq This example is for online migration. To make it offline add -Offline to the parameters. +Note : +Create a new database migration to a given SQL VM. +Note - For the Scope parameter, use the Scope of the SQL VM (/subscriptions/111-222/resourceGroups/myRG/providers/Microsoft.SqlVirtualMachine/SqlVirtualMachines/xyz-SqlVM) and not the Compute SQL VM (/subscriptions/111-222/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/xyz-SqlVM) + ## PARAMETERS ### -AsJob @@ -127,7 +130,7 @@ Accept wildcard characters: False Password for username to access file share location. ```yaml -Type: System.String +Type: System.Security.SecureString Parameter Sets: (All) Aliases: @@ -183,21 +186,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -MigrationOperationId -ID tracking current migration operation. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -MigrationService Resource Id of the Migration Service. @@ -275,21 +263,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProvisioningError -Error message for migration provisioning failure, if any. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ResourceGroupName Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @@ -307,7 +280,8 @@ Accept wildcard characters: False ``` ### -Scope -Resource Id of the target resource (SQL VM or SQL Managed Instance) +Resource Id of the target resource (SQL VM). +For the Scope parameter, use the Scope of the SQL VM (/subscriptions/111-222/resourceGroups/myRG/providers/Microsoft.SqlVirtualMachine/SqlVirtualMachines/xyz-SqlVM) and not the Compute SQL VM (/subscriptions/111-222/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/xyz-SqlVM) ```yaml Type: System.String @@ -385,7 +359,7 @@ Accept wildcard characters: False Password to connect to source SQL. ```yaml -Type: System.String +Type: System.Security.SecureString Parameter Sets: (All) Aliases: @@ -554,7 +528,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.IDatabaseMigrationSqlVM +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IDatabaseMigrationSqlVM ## NOTES diff --git a/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationSqlService.md b/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationSqlService.md index 68c89c5d32cc..cee8686148a0 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationSqlService.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationSqlService.md @@ -215,6 +215,7 @@ INPUTOBJECT : Identity Parameter - `[Id ]`: Resource identity path - `[ManagedInstanceName ]`: - `[ResourceGroupName ]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SqlDbInstanceName ]`: - `[SqlMigrationServiceName ]`: Name of the SQL Migration Service. - `[SqlVirtualMachineName ]`: - `[SubscriptionId ]`: Subscription ID that identifies an Azure subscription. diff --git a/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationSqlServiceNode.md b/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationSqlServiceNode.md index f0b8045323d1..1fc390976035 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationSqlServiceNode.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationSqlServiceNode.md @@ -207,7 +207,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.IDeleteNode +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IDeleteNode ## NOTES @@ -222,6 +222,7 @@ INPUTOBJECT : Identity Parameter - `[Id ]`: Resource identity path - `[ManagedInstanceName ]`: - `[ResourceGroupName ]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SqlDbInstanceName ]`: - `[SqlMigrationServiceName ]`: Name of the SQL Migration Service. - `[SqlVirtualMachineName ]`: - `[SubscriptionId ]`: Subscription ID that identifies an Azure subscription. diff --git a/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationToSqlDb.md b/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationToSqlDb.md new file mode 100644 index 000000000000..ab711c50df3b --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/docs/Remove-AzDataMigrationToSqlDb.md @@ -0,0 +1,264 @@ +--- +external help file: +Module Name: Az.DataMigration +online version: https://docs.microsoft.com/powershell/module/az.datamigration/remove-azdatamigrationtosqldb +schema: 2.0.0 +--- + +# Remove-AzDataMigrationToSqlDb + +## SYNOPSIS +Remove the specified database migration for a given SQL Db. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzDataMigrationToSqlDb -ResourceGroupName -SqlDbInstanceName -TargetDbName + [-SubscriptionId ] [-Force] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzDataMigrationToSqlDb -InputObject [-Force] [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Remove the specified database migration for a given SQL Db. + +## EXAMPLES + +### Example 1: Delete the SQL DB Database Migration resource. +```powershell +Remove-AzDataMigrationToSqlDb -ResourceGroupName tsum38RG -SqlDbInstanceName dmstestsqldb -TargetDbName at_sqldbtrgtps1 +``` + +Delete the SQL DB Database Migration resource. + +### Example 2: Delete the SQL DB Database Migration resource even if it is in progress +```powershell +Remove-AzDataMigrationToSqlDb -ResourceGroupName tsum38RG -SqlDbInstanceName dmstestsqldb -TargetDbName at_sqldbtrgtps1 -Force +``` + +Forcibly deletes an ongoing Migration to SQL DB by adding the optional "Force" parameter + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Force +Optional force delete boolean. +If this is provided as true, migration will be deleted even if active. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.IDataMigrationIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SqlDbInstanceName +. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription ID that identifies an Azure subscription. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetDbName +The name of the target database. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.IDataMigrationIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +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 : Identity Parameter + - `[Id ]`: Resource identity path + - `[ManagedInstanceName ]`: + - `[ResourceGroupName ]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SqlDbInstanceName ]`: + - `[SqlMigrationServiceName ]`: Name of the SQL Migration Service. + - `[SqlVirtualMachineName ]`: + - `[SubscriptionId ]`: Subscription ID that identifies an Azure subscription. + - `[TargetDbName ]`: The name of the target database. + +## RELATED LINKS + diff --git a/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlDb.md b/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlDb.md new file mode 100644 index 000000000000..0916471ecc6d --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlDb.md @@ -0,0 +1,225 @@ +--- +external help file: +Module Name: Az.DataMigration +online version: https://docs.microsoft.com/powershell/module/az.datamigration/stop-azdatamigrationtosqldb +schema: 2.0.0 +--- + +# Stop-AzDataMigrationToSqlDb + +## SYNOPSIS +Stop in-progress database migration to SQL Db. + +## SYNTAX + +``` +Stop-AzDataMigrationToSqlDb -ResourceGroupName -SqlDbInstanceName -TargetDbName + -MigrationOperationId [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Stop in-progress database migration to SQL Db. + +## EXAMPLES + +### Example 1: Stop in-progress migration to SQL DB +```powershell +$dbMigration = Get-AzDataMigrationToSqlDb -ResourceGroupName "myRG" -SqlDbInstanceName "mySqlDb" -TargetDbName "mydb1" +Stop-AzDataMigrationToSqlDb -ResourceGroupName "myRG" -SqlDbInstanceName "mySqlDb" -TargetDbName "mydb1" -MigrationOperationId $dbMigration.MigrationOperationId + +Get-AzDataMigrationToSqlDb -InputObject $dbMigration +``` + +```output +Name Type Kind ProvisioningState MigrationStatus +---- ---- ---- ----------------- --------------- +mydb1 Microsoft.DataMigration/databaseMigrations SqlDb Canceling Canceling +``` + +This command stops the in-progress migration to SQL Managed Instance. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MigrationOperationId +ID tracking migration operation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SqlDbInstanceName +. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription ID that identifies an Azure subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetDbName +The name of the target database. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlManagedInstance.md b/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlManagedInstance.md index 79772c263270..3660d1c6e86b 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlManagedInstance.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlManagedInstance.md @@ -14,8 +14,8 @@ Stop in-progress database migration to SQL Managed Instance. ``` Stop-AzDataMigrationToSqlManagedInstance -ManagedInstanceName -ResourceGroupName - -TargetDbName [-SubscriptionId ] [-MigrationOperationId ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] + -TargetDbName -MigrationOperationId [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] ``` ## DESCRIPTION @@ -93,7 +93,7 @@ Type: System.String Parameter Sets: (All) Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False diff --git a/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlVM.md b/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlVM.md index 118c19a47448..fb7442e95f72 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlVM.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Stop-AzDataMigrationToSqlVM.md @@ -14,7 +14,7 @@ Stop in-progress database migration to SQL VM. ``` Stop-AzDataMigrationToSqlVM -ResourceGroupName -SqlVirtualMachineName -TargetDbName - [-SubscriptionId ] [-MigrationOperationId ] [-DefaultProfile ] [-AsJob] [-NoWait] + -MigrationOperationId [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] ``` @@ -78,7 +78,7 @@ Type: System.String Parameter Sets: (All) Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False diff --git a/src/DataMigration/DataMigration.Autorest/docs/Update-AzDataMigrationSqlService.md b/src/DataMigration/DataMigration.Autorest/docs/Update-AzDataMigrationSqlService.md index fe1f2368912a..5675795afafc 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/Update-AzDataMigrationSqlService.md +++ b/src/DataMigration/DataMigration.Autorest/docs/Update-AzDataMigrationSqlService.md @@ -236,7 +236,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20211030Preview.ISqlMigrationService +### Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.ISqlMigrationService ## NOTES @@ -251,6 +251,7 @@ INPUTOBJECT : Identity Parameter - `[Id ]`: Resource identity path - `[ManagedInstanceName ]`: - `[ResourceGroupName ]`: Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SqlDbInstanceName ]`: - `[SqlMigrationServiceName ]`: Name of the SQL Migration Service. - `[SqlVirtualMachineName ]`: - `[SubscriptionId ]`: Subscription ID that identifies an Azure subscription. diff --git a/src/DataMigration/DataMigration.Autorest/docs/readme.md b/src/DataMigration/DataMigration.Autorest/docs/readme.md index f7b0aa183673..6b3a68ca7b81 100644 --- a/src/DataMigration/DataMigration.Autorest/docs/readme.md +++ b/src/DataMigration/DataMigration.Autorest/docs/readme.md @@ -1,5 +1,5 @@ # Docs -This directory contains the documentation of the cmdlets for the `Az.DataMigration` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overriden on regeneration*. To update documentation examples, please use the `..\examples` folder. +This directory contains the documentation of the cmdlets for the `Az.DataMigration` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder. ## Info - Modifiable: no diff --git a/src/DataMigration/DataMigration.Autorest/examples/Get-AzDataMigrationPerformanceDataCollection.md b/src/DataMigration/DataMigration.Autorest/examples/Get-AzDataMigrationPerformanceDataCollection.md index a5ca654922f8..5398f5bfb91a 100644 --- a/src/DataMigration/DataMigration.Autorest/examples/Get-AzDataMigrationPerformanceDataCollection.md +++ b/src/DataMigration/DataMigration.Autorest/examples/Get-AzDataMigrationPerformanceDataCollection.md @@ -56,3 +56,4 @@ Event and Error Logs Folder Path: C:\Users\vmanhas\AppData\Local\Microsoft\SqlAs This command runs Performance Data Collection on given SQL Server using the config file. + diff --git a/src/DataMigration/DataMigration.Autorest/examples/Get-AzDataMigrationToSqlDb.md b/src/DataMigration/DataMigration.Autorest/examples/Get-AzDataMigrationToSqlDb.md new file mode 100644 index 000000000000..b106e11cbbb8 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/examples/Get-AzDataMigrationToSqlDb.md @@ -0,0 +1,25 @@ +### Example 1: Get the details of a given Database Migration to a SQL DB +```powershell +Get-AzDataMigrationToSqlDb -ResourceGroupName "myRG" -SqlDbInstanceName "mySqlDb" -TargetDbName "mydb1" +``` + +```output +Name Kind ProvisioningState MigrationStatus +---- ---- ----------------- --------------- +mydb1 SqlDb Succeeded InProgress +``` + +Get the details of a given Database Migration to a SQL DB + +### Example 2: Get the expanded details of a given Database Migration to a SQL DB +```powershell +$dbMigration = Get-AzDataMigrationToSqlDb -ResourceGroupName "myRG" -SqlDbInstanceName "mySqlDb" -TargetDbName "mydb1" -Expand MigrationStatusDetails +$dbMigration.MigrationStatusDetailMigrationState +``` + +```output +MonitorMigration +``` + +Get the expanded details of a given Database Migration to a SQL DB + diff --git a/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlDb.md b/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlDb.md new file mode 100644 index 000000000000..58a704961470 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlDb.md @@ -0,0 +1,28 @@ +### Example 1: Start a Database Migration from the on-premise Source Sql Server to target Sql Db +```powershell +New-AzDataMigrationToSqlDb -ResourceGroupName myRG -SqlDbInstanceName "mysqldb" -MigrationService "/subscriptions/1111-2222-3333-4444/resourceGroups/myRG/providers/Microsoft.DataMigration/SqlMigrationServices/myDMS" -TargetSqlConnectionAuthentication "SqlAuthentication" -TargetSqlConnectionDataSource "mydb.windows.net" -TargetSqlConnectionPassword "pass" -TargetSqlConnectionUserName "user" -SourceSqlConnectionAuthentication "SqlAuthentication" -SourceSqlConnectionDataSource "xyz.MICROSOFT.COM" -SourceSqlConnectionUserName "user1" -SourceSqlConnectionPassword "password" -SourceDatabaseName "sourcedb" -TargetDbName "mydb1" -Scope "/subscriptions/1111-2222-3333-4444/resourceGroups/myRG/providers/Microsoft.Sql/servers/mysqldb" +``` + +```output +Name Kind ProvisioningState MigrationStatus +----- ---- ----------------- --------------- +mydb1 SqlDb Succeeded InProgress +``` + +Start a Database Migration from the on-premise Source Sql Server to target Sql Db + +### Example 2: Start a Database Migration with some selcted tables from the on-premise Source Sql Server to target Sql Db +```powershell +$sourcePassword = ConvertTo-SecureString "pass123" -AsPlainText -Force +$targetPassword = ConvertTo-SecureString "pass123" -AsPlainText -Force +New-AzDataMigrationToSqlDb -ResourceGroupName myRG -SqlDbInstanceName "mysqldb" -MigrationService "/subscriptions/1111-2222-3333-4444/resourceGroups/myRG/providers/Microsoft.DataMigration/SqlMigrationServices/myDMS" -TargetSqlConnectionAuthentication "SqlAuthentication" -TargetSqlConnectionDataSource "mydb.windows.net" -TargetSqlConnectionPassword $targetPassword -TargetSqlConnectionUserName "user" -SourceSqlConnectionAuthentication "SqlAuthentication" -SourceSqlConnectionDataSource "xyz.MICROSOFT.COM" -SourceSqlConnectionUserName "user1" -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName "sourcedb" -TargetDbName "mydb1" -Scope "/subscriptions/1111-2222-3333-4444/resourceGroups/myRG/providers/Microsoft.Sql/servers/mysqldb" -TableList "table_1" +``` + +```output +Name Kind ProvisioningState MigrationStatus +----- ---- ----------------- --------------- +mydb1 SqlDb Succeeded InProgress +``` + +Start a Database Migration with some selcted tables from the on-premise Source Sql Server to target Sql Db + diff --git a/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlManagedInstance.md b/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlManagedInstance.md index 9d31886e2558..aca28ee9819e 100644 --- a/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlManagedInstance.md +++ b/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlManagedInstance.md @@ -1,6 +1,8 @@ ### Example 1: Start a Database Migration from the on-premise Source Sql Server to target Managed Instance ```powershell -New-AzDataMigrationToSqlManagedInstance -ResourceGroupName "MyResourceGroup" -ManagedInstanceName "MyManagedInstance" -TargetDbName "MyDb" -Kind "SqlMI" -Scope "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.Sql/managedInstances/MyManagedInstance" -MigrationService "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyRG/providers/Microsoft.DataMigration/SqlMigrationServices/MySqlMigrationService" -StorageAccountResourceId "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/MyStorageAccount" -StorageAccountKey "aaaaacccccoouunntkkkkeeeyyy" -FileSharePath "\\filesharepath.com\SharedBackup\MyBackUps" -FileShareUsername "filesharepath\User" -FileSharePassword "password" -SourceSqlConnectionAuthentication "SqlAuthentication" -SourceSqlConnectionDataSource "LabServer.database.net" -SourceSqlConnectionUserName "User" -SourceSqlConnectionPassword "password" -SourceDatabaseName "AdventureWorks" +$sourcePassword = ConvertTo-SecureString "pass123" -AsPlainText -Force +$filesharePassword = ConvertTo-SecureString "pass123" -AsPlainText -Force +New-AzDataMigrationToSqlManagedInstance -ResourceGroupName "MyResourceGroup" -ManagedInstanceName "MyManagedInstance" -TargetDbName "MyDb" -Kind "SqlMI" -Scope "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.Sql/managedInstances/MyManagedInstance" -MigrationService "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyRG/providers/Microsoft.DataMigration/SqlMigrationServices/MySqlMigrationService" -StorageAccountResourceId "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/MyStorageAccount" -StorageAccountKey "aaaaacccccoouunntkkkkeeeyyy" -FileSharePath "\\filesharepath.com\SharedBackup\MyBackUps" -FileShareUsername "filesharepath\User" -FileSharePassword $filesharePassword -SourceSqlConnectionAuthentication "SqlAuthentication" -SourceSqlConnectionDataSource "LabServer.database.net" -SourceSqlConnectionUserName "User" -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName "AdventureWorks" ``` ```output diff --git a/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlVM.md b/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlVM.md index 4af9fe173b4f..c907a463635e 100644 --- a/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlVM.md +++ b/src/DataMigration/DataMigration.Autorest/examples/New-AzDataMigrationToSqlVM.md @@ -1,6 +1,9 @@ ### Example 1: Start a Database Migration from the on-premise Source Sql Server to target Sql VM ```powershell -New-AzDataMigrationToSqlVM -ResourceGroupName "MyResourceGroup" -SqlVirtualMachineName "MyVM" -TargetDbName "MyDb" -Kind "SqlVm" -Scope "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachine/MyVM" -MigrationService "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.DataMigration/SqlMigrationServices/MySqlMigrationService" -StorageAccountResourceId "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/MyStorageAccount" -StorageAccountKey "aaaaaccccoooouuunnntttkkkeeeyy" -FileSharePath "\\filesharepath.com\SharedBackup\MyBackUps" -FileShareUsername "filesharepath\User" -FileSharePassword "password" -SourceSqlConnectionAuthentication "SqlAuthentication" -SourceSqlConnectionDataSource "LabServer.database.net" -SourceSqlConnectionUserName "User" -SourceSqlConnectionPassword "password" -SourceDatabaseName "AdventureWorks" +$sourcePassword = ConvertTo-SecureString "pass123" -AsPlainText -Force +$filesharePassword = ConvertTo-SecureString "pass123" -AsPlainText -Force + +New-AzDataMigrationToSqlVM -ResourceGroupName "MyResourceGroup" -SqlVirtualMachineName "MyVM" -TargetDbName "MyDb" -Kind "SqlVm" -Scope "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachine/MyVM" -MigrationService "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.DataMigration/SqlMigrationServices/MySqlMigrationService" -StorageAccountResourceId "/subscriptions/0000-1111-2222-3333-4444/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/MyStorageAccount" -StorageAccountKey "aaaaaccccoooouuunnntttkkkeeeyy" -FileSharePath "\\filesharepath.com\SharedBackup\MyBackUps" -FileShareUsername "filesharepath\User" -FileSharePassword $filesharePassword -SourceSqlConnectionAuthentication "SqlAuthentication" -SourceSqlConnectionDataSource "LabServer.database.net" -SourceSqlConnectionUserName "User" -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName "AdventureWorks" ``` ```output @@ -10,5 +13,7 @@ MyDb Microsoft.DataMigration/databaseMigrations SqlVm Succeeded ``` This command starts a Database Migration from the Source Sql Server to target Sql VM. This example is for online migration. To make it offline add -Offline to the parameters. +Note : +Create a new database migration to a given SQL VM. Note - For the Scope parameter, use the Scope of the SQL VM (/subscriptions/111-222/resourceGroups/myRG/providers/Microsoft.SqlVirtualMachine/SqlVirtualMachines/xyz-SqlVM) and not the Compute SQL VM (/subscriptions/111-222/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/xyz-SqlVM) diff --git a/src/DataMigration/DataMigration.Autorest/examples/Remove-AzDataMigrationToSqlDb.md b/src/DataMigration/DataMigration.Autorest/examples/Remove-AzDataMigrationToSqlDb.md new file mode 100644 index 000000000000..0616d1fa3b17 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/examples/Remove-AzDataMigrationToSqlDb.md @@ -0,0 +1,14 @@ +### Example 1: Delete the SQL DB Database Migration resource. +```powershell +Remove-AzDataMigrationToSqlDb -ResourceGroupName tsum38RG -SqlDbInstanceName dmstestsqldb -TargetDbName at_sqldbtrgtps1 +``` + +Delete the SQL DB Database Migration resource. + +### Example 2: Delete the SQL DB Database Migration resource even if it is in progress +```powershell +Remove-AzDataMigrationToSqlDb -ResourceGroupName tsum38RG -SqlDbInstanceName dmstestsqldb -TargetDbName at_sqldbtrgtps1 -Force +``` + +Forcibly deletes an ongoing Migration to SQL DB by adding the optional "Force" parameter + diff --git a/src/DataMigration/DataMigration.Autorest/examples/Stop-AzDataMigrationToSqlDb.md b/src/DataMigration/DataMigration.Autorest/examples/Stop-AzDataMigrationToSqlDb.md new file mode 100644 index 000000000000..ddf29aff8885 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/examples/Stop-AzDataMigrationToSqlDb.md @@ -0,0 +1,15 @@ +### Example 1: Stop in-progress migration to SQL DB +```powershell +$dbMigration = Get-AzDataMigrationToSqlDb -ResourceGroupName "myRG" -SqlDbInstanceName "mySqlDb" -TargetDbName "mydb1" +Stop-AzDataMigrationToSqlDb -ResourceGroupName "myRG" -SqlDbInstanceName "mySqlDb" -TargetDbName "mydb1" -MigrationOperationId $dbMigration.MigrationOperationId + +Get-AzDataMigrationToSqlDb -InputObject $dbMigration +``` + +```output +Name Type Kind ProvisioningState MigrationStatus +---- ---- ---- ----------------- --------------- +mydb1 Microsoft.DataMigration/databaseMigrations SqlDb Canceling Canceling +``` + +This command stops the in-progress migration to SQL Managed Instance. \ No newline at end of file diff --git a/src/DataMigration/DataMigration.Autorest/how-to.md b/src/DataMigration/DataMigration.Autorest/how-to.md index 096f597fd432..3dc1a7a13cbd 100644 --- a/src/DataMigration/DataMigration.Autorest/how-to.md +++ b/src/DataMigration/DataMigration.Autorest/how-to.md @@ -2,16 +2,16 @@ This document describes how to develop for `Az.DataMigration`. ## Building `Az.DataMigration` -To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [readme.md](exports/readme.md) in the `exports` folder. +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder. ## Creating custom cmdlets -To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [readme.md](custom/readme.md) in the `custom` folder. +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [README.md](custom/README.md) in the `custom` folder. ## Generating documentation -To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [readme.md](examples/readme.md) in the `examples` folder. To read more about documentation, look at the [readme.md](docs/readme.md) in the `docs` folder. +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder. ## Testing `Az.DataMigration` -To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [readme.md](examples/readme.md) in the `examples` folder. +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder. ## Packing `Az.DataMigration` To pack `Az.DataMigration` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. diff --git a/src/DataMigration/DataMigration.Autorest/readme.md b/src/DataMigration/DataMigration.Autorest/readme.md index 55b37e14c663..eaec4006c997 100644 --- a/src/DataMigration/DataMigration.Autorest/readme.md +++ b/src/DataMigration/DataMigration.Autorest/readme.md @@ -30,11 +30,11 @@ For information on how to develop for `Az.DataMigration`, see [how-to.md](how-to > see https://aka.ms/autorest ``` yaml -branch: 7086ee861c3a6196bb98f8b327af11d03e545a05 +branch: e8c359d8821038f133695c9b1f4cf40d330cbc80 require: - $(this-folder)/../../readme.azure.noprofile.md -input-file: - - $(repo)/specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2021-10-30-preview/sqlmigration.json +input-file: + - $(repo)/specification/datamigration/resource-manager/Microsoft.DataMigration/preview/2022-03-30-preview/sqlmigration.json title: DataMigration module-version: 0.1.0 @@ -42,6 +42,10 @@ module-version: 0.1.0 directive: #Swagger description changes + #- from: swagger-document + # where: $.info + # transform: $["version"] = "2022-01-30-preview" + - from: swagger-document where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}"].get transform: $["description"] = "Retrieve the Database Migration Service." @@ -57,6 +61,10 @@ directive: - from: swagger-document where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}"].get transform: $["description"] = "Retrieve the specified database migration for a given SQL VM." + + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{sqlDbInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}"].get + transform: $["description"] = "Retrieve the specified database migration for a given SQL Db." - from: swagger-document where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}/cutover"].post @@ -78,6 +86,10 @@ directive: where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}"].put transform: $["description"] = "Create a new database migration to a given SQL VM." + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{sqlDbInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}"].put + transform: $["description"] = "Create a new database migration to a given SQL Db." + - from: swagger-document where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}"].delete transform: $["description"] = "Delete Database Migration Service." @@ -89,6 +101,14 @@ directive: - from: swagger-document where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}/cancel"].post transform: $["description"] = "Stop in-progress database migration to SQL VM." + + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{sqlDbInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}/cancel"].post + transform: $["description"] = "Stop in-progress database migration to SQL Db." + + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{sqlDbInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}"].delete + transform: $["description"] = "Remove the specified database migration for a given SQL Db." - from: swagger-document where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}"].patch @@ -145,6 +165,16 @@ directive: set: subject: ToSqlVM + - where: + subject: (DatabaseMigrationSqlDb$) + set: + subject: ToSqlDb + + - where: + subject: DatabaseMigrationsSqlDb + set: + subject: ToSqlDb + - where: subject: (MonitoringData$) set: @@ -155,6 +185,49 @@ directive: set: subject: SqlService + #Deleting parameters : + - where: + verb: New + subject: ToSqlDb + parameter-name: MigrationOperationId + hide: true + + - where: + verb: New + subject: ToSqlManagedInstance + parameter-name: MigrationOperationId + hide: true + + - where: + verb: New + subject: ToSqlVM + parameter-name: MigrationOperationId + hide: true + + - where: + verb: New + subject: ToSqlDb + parameter-name: ProvisioningError + hide: true + + - where: + verb: New + subject: ToSqlManagedInstance + parameter-name: ProvisioningError + hide: true + + - where: + verb: New + subject: ToSqlVM + parameter-name: ProvisioningError + hide: true + + - where: + verb: Get + subject: ToSqlDb + parameter-name: PassThru + hide: true + #Changing parameter names - where: verb: New @@ -198,6 +271,14 @@ directive: set: parameter-name: StorageAccountKey + # Changing parameter description + - where: + parameter-name: Scope + verb: New + subject: ToSqlVM + set: + parameter-description: Resource Id of the target resource (SQL VM). For the Scope parameter, use the Scope of the SQL VM (/subscriptions/111-222/resourceGroups/myRG/providers/Microsoft.SqlVirtualMachine/SqlVirtualMachines/xyz-SqlVM) and not the Compute SQL VM (/subscriptions/111-222/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/xyz-SqlVM) + # Remove the set-* cmdlet - where: verb: Set @@ -234,6 +315,16 @@ directive: - Kind - ProvisioningState - MigrationStatus + - where: + model-name: DatabaseMigrationSqlDb + set: + format-table: + properties: + - Name + - Type + - Kind + - ProvisioningState + - MigrationStatus - where: model-name: DatabaseMigration set: @@ -244,4 +335,28 @@ directive: - Kind - ProvisioningState - MigrationStatus + + # Giving preview message to each command + - where: + subject: (^SqlService) + set: + preview-message: This is a SQL Service resource and can only be accessed using cmdlets that have SqlService in their name. (For example Get-AzDataMigrationSqlService should be used to access a data migration SQL Service and NOT Get-AzDataMigrationService) + - where: + subject: (^ToSqlManagedInstance) + set: + preview-message: Only use cmdlets containing ToSqlManagedInstance in their name for getting or deleting or performing cutover on a migration created using New-AzDataMigrationToSqlManagedInstance + - where: + subject: (^ToSqlVM) + set: + preview-message: Only use cmdlets containing ToSqlVM in their name for getting or deleting or performing cutover on a migration created using New-AzDataMigrationToSqlVM + - where: + subject: (^ToSqlDb) + set: + preview-message: Only use cmdlets containing ToSqlDb in their name for getting or stopping or deleting a migration created using New-AzDataMigrationToSqlDb + + # Making parameters required/optional + - from: swagger-document + where: $.definitions.MigrationOperationInput + transform: $['required'] = ['migrationOperationId'] + ``` diff --git a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlService.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlService.Tests.ps1 index 589983da832d..7cd54a9acc7b 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlService.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlService.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Get-AzDataMigrationSqlService' { - It 'List1' { + It 'List1' -skip { $instance = Get-AzDataMigrationSqlService -SubscriptionId $env.SubscriptionId $assert = $instance.Count -gt 0 $assert | Should be $true diff --git a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceAuthKey.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceAuthKey.Tests.ps1 index 553b9cc821cf..53d84d54899a 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceAuthKey.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceAuthKey.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Get-AzDataMigrationSqlServiceAuthKey' { - It 'List' { + It 'List' -skip { $instance = Get-AzDataMigrationSqlServiceAuthKey -SubscriptionId $env.SubscriptionId -ResourceGroupName $env.TestSqlMigrationService.GroupName -SqlMigrationServiceName $env.TestSqlMigrationService.SqlMigrationServiceName $assert = ($instance.psobject.properties.name[0] -eq 'AuthKey1') -AND ($instance.psobject.properties.name[1] -eq 'AuthKey2') $assert | Should be $true diff --git a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric.Tests.ps1 index b3b459aecd87..57c68611e052 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric' { - It 'List' { + It 'List' -skip { $instance = Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric -SubscriptionId $env.SubscriptionId -ResourceGroupName $env.TestSqlMigrationService.GroupName -SqlMigrationServiceName $env.TestSqlMigrationService.SqlMigrationServiceName $instance.Name | should be 'default-ir' } diff --git a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceMigration.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceMigration.Tests.ps1 index 960ea3be89b0..a704b883dc1d 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceMigration.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationSqlServiceMigration.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Get-AzDataMigrationSqlServiceMigration' { - It 'List' { + It 'List' -skip { $instance = Get-AzDataMigrationSqlServiceMigration -SubscriptionId $env.SubscriptionId -ResourceGroupName $env.TestSqlMigrationService.GroupName -SqlMigrationServiceName $env.TestSqlMigrationService.SqlMigrationServiceName $assert = $instance.Count -gt 0 $assert | Should be $true diff --git a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlDb.Recording.json b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlDb.Recording.json new file mode 100644 index 000000000000..c5009419810c --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlDb.Recording.json @@ -0,0 +1,43 @@ +{ + "Get-AzDataMigrationToSqlDb+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt3?api-version=2022-03-30-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt3?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "7502bade-7c5f-43cc-9531-a5b511bb91f8" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "63e0a7f8-d90f-48d4-a0a1-2ebd26135440" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "02191b1c-4a57-4b0e-9278-44be758da501" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113817Z:02191b1c-4a57-4b0e-9278-44be758da501" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:38:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1001" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Succeeded\",\"migrationStatus\":\"Succeeded\",\"startedOn\":\"2022-03-30T07:36:11.593Z\",\"endedOn\":\"2022-03-30T07:38:24.38Z\",\"sourceServerName\":\"server.microsoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"61d97f7a-6a0c-4a0d-abc1-c282bf821e1a\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt3\",\"name\":\"at_sqldbtrgt3\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlDb.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlDb.Tests.ps1 new file mode 100644 index 000000000000..d99b507af361 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlDb.Tests.ps1 @@ -0,0 +1,27 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzDataMigrationToSqlDb')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzDataMigrationToSqlDb.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzDataMigrationToSqlDb' { + It 'Get' -skip{ + $instance = Get-AzDataMigrationToSqlDb -SqlDbInstanceName $env.TestDatabaseMigrationDb.SqlDbInstanceName -ResourceGroupName $env.TestDatabaseMigrationDb.ResourceGroupName -TargetDbName $env.TestDatabaseMigrationDb.TargetDbName + $assert = ($instance.Name -eq $env.TestDatabaseMigrationDb.TargetDbName) -AND ($instance.Kind -eq 'SqlDb') + $assert | Should be $true + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlManagedInstance.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlManagedInstance.Tests.ps1 index a68d9b1e49a5..86ae0d3b4687 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlManagedInstance.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlManagedInstance.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Get-AzDataMigrationToSqlManagedInstance' { - It 'Get' { + It 'Get' -skip { $instance = Get-AzDataMigrationToSqlManagedInstance -ManagedInstanceName $env.TestDatabaseMigrationMi.ManagedInstanceName -ResourceGroupName $env.TestDatabaseMigrationMi.ResourceGroupName -TargetDbName $env.TestDatabaseMigrationMi.TargetDbName $assert = ($instance.Name -eq $env.TestDatabaseMigrationMi.TargetDbName) -AND ($instance.Kind -eq 'SqlMi') $assert | Should be $true diff --git a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlVM.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlVM.Tests.ps1 index 18123f9757ad..ac242cc6f094 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlVM.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Get-AzDataMigrationToSqlVM.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Get-AzDataMigrationToSqlVM' { - It 'Get' { + It 'Get' -skip { $instance = Get-AzDataMigrationToSqlVM -SqlVirtualMachineName $env.TestDatabaseMigrationVm.SqlVirtualMachineName -ResourceGroupName $env.TestDatabaseMigrationVm.ResourceGroupName -TargetDbName $env.TestDatabaseMigrationVm.TargetDbName $assert = ($instance.Name -eq $env.TestDatabaseMigrationVm.TargetDbName) -AND ($instance.Kind -eq 'SqlVm') $assert | Should be $true diff --git a/src/DataMigration/DataMigration.Autorest/test/Invoke-AzDataMigrationCutoverToSqlManagedInstance.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Invoke-AzDataMigrationCutoverToSqlManagedInstance.Tests.ps1 index 5a52a7b17763..3c610e3f5a55 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Invoke-AzDataMigrationCutoverToSqlManagedInstance.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Invoke-AzDataMigrationCutoverToSqlManagedInstance.Tests.ps1 @@ -13,7 +13,10 @@ while(-not $mockingPath) { Describe 'Invoke-AzDataMigrationCutoverToSqlManagedInstance' { It 'CutoverExpanded' -skip { - $instance = New-AzDataMigrationToSqlManagedInstance -ResourceGroupName $env.TestCutDatabaseMigrationMi.ResourceGroupName -ManagedInstanceName $env.TestCutDatabaseMigrationMi.ManagedInstanceName -TargetDbName $env.TestCutDatabaseMigrationMi.TargetDbName -Kind $env.TestCutDatabaseMigrationMi.Kind -Scope $env.TestCutDatabaseMigrationMi.Scope -MigrationService $env.TestCutDatabaseMigrationMi.MigrationService -StorageAccountResourceId $env.TestCutDatabaseMigrationMi.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestCutDatabaseMigrationMi.TargetLocationAccountKey -FileSharePath $env.TestCutDatabaseMigrationMi.FileSharePath -FileShareUsername $env.TestCutDatabaseMigrationMi.FileShareUsername -FileSharePassword $env.TestCutDatabaseMigrationMi.FileSharePassword -SourceSqlConnectionAuthentication $env.TestCutDatabaseMigrationMi.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestCutDatabaseMigrationMi.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestCutDatabaseMigrationMi.SourceSqlConnectionUsername -SourceSqlConnectionPassword $env.TestCutDatabaseMigrationMi.SourceSqlConnectionPassword -SourceDatabaseName $env.TestCutDatabaseMigrationMi.SourceDatabaseName + $filesharePassword = ConvertTo-SecureString $env.TestCutDatabaseMigrationMi.FileSharePassword -AsPlainText -Force + $sourcePassword = ConvertTo-SecureString $env.TestCutDatabaseMigrationMi.SourceSqlConnectionPassword -AsPlainText -Force + + $instance = New-AzDataMigrationToSqlManagedInstance -ResourceGroupName $env.TestCutDatabaseMigrationMi.ResourceGroupName -ManagedInstanceName $env.TestCutDatabaseMigrationMi.ManagedInstanceName -TargetDbName $env.TestCutDatabaseMigrationMi.TargetDbName -Kind $env.TestCutDatabaseMigrationMi.Kind -Scope $env.TestCutDatabaseMigrationMi.Scope -MigrationService $env.TestCutDatabaseMigrationMi.MigrationService -StorageAccountResourceId $env.TestCutDatabaseMigrationMi.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestCutDatabaseMigrationMi.TargetLocationAccountKey -FileSharePath $env.TestCutDatabaseMigrationMi.FileSharePath -FileShareUsername $env.TestCutDatabaseMigrationMi.FileShareUsername -FileSharePassword $filesharePassword -SourceSqlConnectionAuthentication $env.TestCutDatabaseMigrationMi.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestCutDatabaseMigrationMi.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestCutDatabaseMigrationMi.SourceSqlConnectionUsername -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName $env.TestCutDatabaseMigrationMi.SourceDatabaseName $details = Get-AzDataMigrationToSqlManagedInstance -ManagedInstanceName $env.TestCutDatabaseMigrationMi.ManagedInstanceName -ResourceGroupName $env.TestCutDatabaseMigrationMi.ResourceGroupName -TargetDbName $env.TestCutDatabaseMigrationMi.TargetDbName while(-Not $details.MigrationStatusDetail.IsFullBackupRestored){ $details = Get-AzDataMigrationToSqlManagedInstance -ManagedInstanceName $env.TestCutDatabaseMigrationMi.ManagedInstanceName -ResourceGroupName $env.TestCutDatabaseMigrationMi.ResourceGroupName -TargetDbName $env.TestCutDatabaseMigrationMi.TargetDbName diff --git a/src/DataMigration/DataMigration.Autorest/test/Invoke-AzDataMigrationCutoverToSqlVM.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Invoke-AzDataMigrationCutoverToSqlVM.Tests.ps1 index 562bd54e4ca5..5f8ecfd42beb 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Invoke-AzDataMigrationCutoverToSqlVM.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Invoke-AzDataMigrationCutoverToSqlVM.Tests.ps1 @@ -13,7 +13,10 @@ while(-not $mockingPath) { Describe 'Invoke-AzDataMigrationCutoverToSqlVM' { It 'CutoverExpanded' -skip{ - $instance = New-AzDataMigrationToSqlVM -ResourceGroupName $env.TestCutDatabaseMigrationVm.ResourceGroupName -SqlVirtualMachineName $env.TestCutDatabaseMigrationVm.SqlVirtualMachineName -TargetDbName $env.TestCutDatabaseMigrationVm.TargetDbName -Kind $env.TestCutDatabaseMigrationVm.Kind -Scope $env.TestCutDatabaseMigrationVm.Scope -MigrationService $env.TestCutDatabaseMigrationVm.MigrationService -StorageAccountResourceId $env.TestCutDatabaseMigrationVm.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestCutDatabaseMigrationVm.TargetLocationAccountKey -FileSharePath $env.TestCutDatabaseMigrationVm.FileSharePath -FileShareUsername $env.TestCutDatabaseMigrationVm.FileShareUsername -FileSharePassword $env.TestCutDatabaseMigrationVm.FileSharePassword -SourceSqlConnectionAuthentication $env.TestCutDatabaseMigrationVm.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestCutDatabaseMigrationVm.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestCutDatabaseMigrationVm.SourceSqlConnectionUsername -SourceSqlConnectionPassword $env.TestCutDatabaseMigrationVm.SourceSqlConnectionPassword -SourceDatabaseName $env.TestCutDatabaseMigrationVm.SourceDatabaseName + $filesharePassword = ConvertTo-SecureString $env.TestCutDatabaseMigrationVm.FileSharePassword -AsPlainText -Force + $sourcePassword = ConvertTo-SecureString $env.TestCutDatabaseMigrationVm.SourceSqlConnectionPassword -AsPlainText -Force + + $instance = New-AzDataMigrationToSqlVM -ResourceGroupName $env.TestCutDatabaseMigrationVm.ResourceGroupName -SqlVirtualMachineName $env.TestCutDatabaseMigrationVm.SqlVirtualMachineName -TargetDbName $env.TestCutDatabaseMigrationVm.TargetDbName -Kind $env.TestCutDatabaseMigrationVm.Kind -Scope $env.TestCutDatabaseMigrationVm.Scope -MigrationService $env.TestCutDatabaseMigrationVm.MigrationService -StorageAccountResourceId $env.TestCutDatabaseMigrationVm.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestCutDatabaseMigrationVm.TargetLocationAccountKey -FileSharePath $env.TestCutDatabaseMigrationVm.FileSharePath -FileShareUsername $env.TestCutDatabaseMigrationVm.FileShareUsername -FileSharePassword $filesharePassword -SourceSqlConnectionAuthentication $env.TestCutDatabaseMigrationVm.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestCutDatabaseMigrationVm.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestCutDatabaseMigrationVm.SourceSqlConnectionUsername -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName $env.TestCutDatabaseMigrationVm.SourceDatabaseName $details = Get-AzDataMigrationToSqlVM -SqlVirtualMachineName $env.TestCutDatabaseMigrationVm.SqlVirtualMachineName -ResourceGroupName $env.TestCutDatabaseMigrationVm.ResourceGroupName -TargetDbName $env.TestCutDatabaseMigrationVm.TargetDbName while(-Not $details.MigrationStatusDetail.IsFullBackupRestored){ $details = Get-AzDataMigrationToSqlVM -SqlVirtualMachineName $env.TestCutDatabaseMigrationVm.SqlVirtualMachineName -ResourceGroupName $env.TestCutDatabaseMigrationVm.ResourceGroupName -TargetDbName $env.TestCutDatabaseMigrationVm.TargetDbName diff --git a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationSqlService.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationSqlService.Tests.ps1 index 1fc7abd371d5..3d620c87441a 100644 --- a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationSqlService.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationSqlService.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'New-AzDataMigrationSqlService' { - It 'CreateExpanded' { + It 'CreateExpanded' -skip { $instance = New-AzDataMigrationSqlService -Name $env.TestNewSqlMigrationService.SqlMigrationServiceName -ResourceGroupName $env.TestNewSqlMigrationService.GroupName -Location $env.TestNewSqlMigrationService.Location $assert = ($instance.Type -eq "Microsoft.DataMigration/sqlMigrationServices") $assert | should be $true diff --git a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationSqlServiceAuthKey.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationSqlServiceAuthKey.Tests.ps1 index 813d00aeea52..02f0470d6d66 100644 --- a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationSqlServiceAuthKey.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationSqlServiceAuthKey.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'New-AzDataMigrationSqlServiceAuthKey' { - It 'RegenerateExpanded' { + It 'RegenerateExpanded' -skip { $oldAuthKeys = Get-AzDataMigrationSqlServiceAuthKey -SubscriptionId $env.SubscriptionId -ResourceGroupName $env.TestAuthKey.GroupName -SqlMigrationServiceName $env.TestAuthKey.SqlMigrationServiceName New-AzDataMigrationSqlServiceAuthKey -SubscriptionId $env.SubscriptionId -ResourceGroupName $env.TestAuthKey.GroupName -SqlMigrationServiceName $env.TestAuthKey.SqlMigrationServiceName -KeyName AuthKey1 New-AzDataMigrationSqlServiceAuthKey -SubscriptionId $env.SubscriptionId -ResourceGroupName $env.TestAuthKey.GroupName -SqlMigrationServiceName $env.TestAuthKey.SqlMigrationServiceName -KeyName AuthKey2 diff --git a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlDb.Recording.json b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlDb.Recording.json new file mode 100644 index 000000000000..4b26020047fd --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlDb.Recording.json @@ -0,0 +1,123 @@ +{ + "New-AzDataMigrationToSqlDb+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt3?api-version=2022-03-30-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt3?api-version=2022-03-30-preview", + "Content": "{\r\n \"properties\": {\r\n \"sourceSqlConnection\": {\r\n \"dataSource\": \"server.microsoft.com\",\r\n \"authentication\": \"SqlAuthentication\",\r\n \"userName\": \"hijavatestuser1\",\r\n \"password\": \"testAdmin123\"\r\n },\r\n \"scope\": \"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\r\n \"sourceDatabaseName\": \"AdventureWorks\",\r\n \"migrationService\": \"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/dms20211030\",\r\n \"targetSqlConnection\": {\r\n \"dataSource\": \"target.windows.net\",\r\n \"authentication\": \"SqlAuthentication\",\r\n \"userName\": \"user\",\r\n \"password\": \"password\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "807" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/createsqldbmigration/operationResults/51fc8262-951d-4858-ad18-52a3dcde7829?api-version=2022-03-30-preview" ], + "x-ms-request-id": [ "c30fad32-7730-46bf-a8cb-44a042e9d79f" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-correlation-request-id": [ "9c6ca1be-56da-4a45-8042-0b0f8517de4e" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113822Z:9c6ca1be-56da-4a45-8042-0b0f8517de4e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:38:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "833" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Creating\",\"sourceServerName\":\"server.microsoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt3\",\"name\":\"at_sqldbtrgt3\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "New-AzDataMigrationToSqlDb+[NoContext]+CreateExpanded+$GET+https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/createsqldbmigration/operationResults/51fc8262-951d-4858-ad18-52a3dcde7829?api-version=2022-03-30-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/createsqldbmigration/operationResults/51fc8262-951d-4858-ad18-52a3dcde7829?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "5c4b7268-cd59-4259-81f1-22a47e376a3d" ], + "CommandName": [ "New-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "New-AzDataMigrationToSqlDb_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "15" ], + "x-ms-request-id": [ "de0ac354-0e17-4f2c-9a19-3bc552990ebe" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "bd00540e-d377-41ed-b087-1bcf285f32fe" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113837Z:bd00540e-d377-41ed-b087-1bcf285f32fe" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:38:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "107" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"51fc8262-951d-4858-ad18-52a3dcde7829\",\"status\":\"Succeeded\",\"startTime\":\"2022-03-30T11:38:21.057Z\"}", + "isContentBase64": false + } + }, + "New-AzDataMigrationToSqlDb+[NoContext]+CreateExpanded+$GET+https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt3?api-version=2022-03-30-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt3?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "5c4b7268-cd59-4259-81f1-22a47e376a3d" ], + "CommandName": [ "New-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "New-AzDataMigrationToSqlDb_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "c4163eb5-9db6-4218-98f0-78d07b824b9e" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "x-ms-correlation-request-id": [ "3b7efd8d-b2ee-4a42-8e5d-c0ec4078e0e4" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113837Z:3b7efd8d-b2ee-4a42-8e5d-c0ec4078e0e4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:38:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "966" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Succeeded\",\"migrationStatus\":\"InProgress\",\"startedOn\":\"2022-03-30T11:38:37.027Z\",\"sourceServerName\":\"server.microsoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"8c712ed1-7d96-4a40-aafa-28683dee8a02\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt3\",\"name\":\"at_sqldbtrgt3\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlDb.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlDb.Tests.ps1 new file mode 100644 index 000000000000..6a46e1584792 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlDb.Tests.ps1 @@ -0,0 +1,27 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzDataMigrationToSqlDb')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzDataMigrationToSqlDb.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzDataMigrationToSqlDb' { + It 'CreateExpanded' -skip { + $targetPassword = ConvertTo-SecureString $env.TestNewDatabaseMigrationDb.TargetSqlConnectionPassword -AsPlainText -Force + $sourcePassword = ConvertTo-SecureString $env.TestNewDatabaseMigrationDb.SourceSqlConnectionPassword -AsPlainText -Force + + $instance = New-AzDataMigrationToSqlDb -ResourceGroupName $env.TestNewDatabaseMigrationDb.ResourceGroupName -SqlDbInstanceName $env.TestNewDatabaseMigrationDb.SqlDbInstanceName -MigrationService $env.TestNewDatabaseMigrationDb.MigrationService -TargetSqlConnectionAuthentication $env.TestNewDatabaseMigrationDb.TargetSqlConnectionAuthentication -TargetSqlConnectionDataSource $env.TestNewDatabaseMigrationDb.TargetSqlConnectionDataSource -TargetSqlConnectionPassword $targetPassword -TargetSqlConnectionUserName $env.TestNewDatabaseMigrationDb.TargetSqlConnectionUserName -SourceSqlConnectionAuthentication $env.TestNewDatabaseMigrationDb.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestNewDatabaseMigrationDb.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestNewDatabaseMigrationDb.SourceSqlConnectionUserName -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName $env.TestNewDatabaseMigrationDb.SourceDatabaseName -TargetDbName $env.TestNewDatabaseMigrationDb.TargetDbName -Scope $env.TestNewDatabaseMigrationDb.Scope + + $assert = ($instance.Type -eq "Microsoft.DataMigration/databaseMigrations") -AND ($instance.Name -eq $env.TestNewDatabaseMigrationDb.TargetDbName) -AND ($instance.ProvisioningState -eq "Succeeded") -AND ($instance.Kind -eq "SqlDb") + $assert | should be $true + } +} diff --git a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlManagedInstance.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlManagedInstance.Tests.ps1 index a8fd8210b8db..69cf6fe604ca 100644 --- a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlManagedInstance.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlManagedInstance.Tests.ps1 @@ -12,8 +12,11 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'New-AzDataMigrationToSqlManagedInstance' { - It 'CreateExpanded' { - $instance = New-AzDataMigrationToSqlManagedInstance -ResourceGroupName $env.TestNewDatabaseMigrationMi.ResourceGroupName -ManagedInstanceName $env.TestNewDatabaseMigrationMi.ManagedInstanceName -TargetDbName $env.TestNewDatabaseMigrationMi.TargetDbName -Kind $env.TestNewDatabaseMigrationMi.Kind -Scope $env.TestNewDatabaseMigrationMi.Scope -MigrationService $env.TestNewDatabaseMigrationMi.MigrationService -StorageAccountResourceId $env.TestNewDatabaseMigrationMi.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestNewDatabaseMigrationMi.TargetLocationAccountKey -FileSharePath $env.TestNewDatabaseMigrationMi.FileSharePath -FileShareUsername $env.TestNewDatabaseMigrationMi.FileShareUsername -FileSharePassword $env.TestNewDatabaseMigrationMi.FileSharePassword -SourceSqlConnectionAuthentication $env.TestNewDatabaseMigrationMi.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestNewDatabaseMigrationMi.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestNewDatabaseMigrationMi.SourceSqlConnectionUsername -SourceSqlConnectionPassword $env.TestNewDatabaseMigrationMi.SourceSqlConnectionPassword -SourceDatabaseName $env.TestNewDatabaseMigrationMi.SourceDatabaseName + It 'CreateExpanded' -skip { + $filesharePassword = ConvertTo-SecureString $env.TestNewDatabaseMigrationMi.FileSharePassword -AsPlainText -Force + $sourcePassword = ConvertTo-SecureString $env.TestNewDatabaseMigrationMi.SourceSqlConnectionPassword -AsPlainText -Force + + $instance = New-AzDataMigrationToSqlManagedInstance -ResourceGroupName $env.TestNewDatabaseMigrationMi.ResourceGroupName -ManagedInstanceName $env.TestNewDatabaseMigrationMi.ManagedInstanceName -TargetDbName $env.TestNewDatabaseMigrationMi.TargetDbName -Kind $env.TestNewDatabaseMigrationMi.Kind -Scope $env.TestNewDatabaseMigrationMi.Scope -MigrationService $env.TestNewDatabaseMigrationMi.MigrationService -StorageAccountResourceId $env.TestNewDatabaseMigrationMi.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestNewDatabaseMigrationMi.TargetLocationAccountKey -FileSharePath $env.TestNewDatabaseMigrationMi.FileSharePath -FileShareUsername $env.TestNewDatabaseMigrationMi.FileShareUsername -FileSharePassword $filesharePassword -SourceSqlConnectionAuthentication $env.TestNewDatabaseMigrationMi.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestNewDatabaseMigrationMi.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestNewDatabaseMigrationMi.SourceSqlConnectionUsername -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName $env.TestNewDatabaseMigrationMi.SourceDatabaseName $assert = ($instance.Type -eq "Microsoft.DataMigration/databaseMigrations") -AND ($instance.Name -eq $env.TestNewDatabaseMigrationMi.TargetDbName) -AND ($instance.ProvisioningState -eq "Succeeded") -AND ($instance.Kind -eq "SqlMi") $assert | should be $true } diff --git a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlVM.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlVM.Tests.ps1 index d3a64e67e563..909aa8de260a 100644 --- a/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlVM.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/New-AzDataMigrationToSqlVM.Tests.ps1 @@ -12,8 +12,11 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'New-AzDataMigrationToSqlVM' { - It 'CreateExpanded' { - $instance = New-AzDataMigrationToSqlVM -ResourceGroupName $env.TestNewDatabaseMigrationVm.ResourceGroupName -SqlVirtualMachineName $env.TestNewDatabaseMigrationVm.SqlVirtualMachineName -TargetDbName $env.TestNewDatabaseMigrationVm.TargetDbName -Kind $env.TestNewDatabaseMigrationVm.Kind -Scope $env.TestNewDatabaseMigrationVm.Scope -MigrationService $env.TestNewDatabaseMigrationVm.MigrationService -StorageAccountResourceId $env.TestNewDatabaseMigrationVm.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestNewDatabaseMigrationVm.TargetLocationAccountKey -FileSharePath $env.TestNewDatabaseMigrationVm.FileSharePath -FileShareUsername $env.TestNewDatabaseMigrationVm.FileShareUsername -FileSharePassword $env.TestNewDatabaseMigrationVm.FileSharePassword -SourceSqlConnectionAuthentication $env.TestNewDatabaseMigrationVm.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestNewDatabaseMigrationVm.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestNewDatabaseMigrationVm.SourceSqlConnectionUsername -SourceSqlConnectionPassword $env.TestNewDatabaseMigrationVm.SourceSqlConnectionPassword -SourceDatabaseName $env.TestNewDatabaseMigrationVm.SourceDatabaseName + It 'CreateExpanded' -skip { + $filesharePassword = ConvertTo-SecureString $env.TestNewDatabaseMigrationVm.FileSharePassword -AsPlainText -Force + $sourcePassword = ConvertTo-SecureString $env.TestNewDatabaseMigrationVm.SourceSqlConnectionPassword -AsPlainText -Force + + $instance = New-AzDataMigrationToSqlVM -ResourceGroupName $env.TestNewDatabaseMigrationVm.ResourceGroupName -SqlVirtualMachineName $env.TestNewDatabaseMigrationVm.SqlVirtualMachineName -TargetDbName $env.TestNewDatabaseMigrationVm.TargetDbName -Kind $env.TestNewDatabaseMigrationVm.Kind -Scope $env.TestNewDatabaseMigrationVm.Scope -MigrationService $env.TestNewDatabaseMigrationVm.MigrationService -StorageAccountResourceId $env.TestNewDatabaseMigrationVm.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestNewDatabaseMigrationVm.TargetLocationAccountKey -FileSharePath $env.TestNewDatabaseMigrationVm.FileSharePath -FileShareUsername $env.TestNewDatabaseMigrationVm.FileShareUsername -FileSharePassword $filesharePassword -SourceSqlConnectionAuthentication $env.TestNewDatabaseMigrationVm.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestNewDatabaseMigrationVm.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestNewDatabaseMigrationVm.SourceSqlConnectionUsername -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName $env.TestNewDatabaseMigrationVm.SourceDatabaseName $assert = ($instance.Type -eq "Microsoft.DataMigration/databaseMigrations") -AND ($instance.Name -eq $env.TestNewDatabaseMigrationVm.TargetDbName) -AND ($instance.ProvisioningState -eq "Succeeded") -AND ($instance.Kind -eq "SqlVm") $assert | should be $true } diff --git a/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationSqlService.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationSqlService.Tests.ps1 index 3e5777e68132..8f16d5aebedb 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationSqlService.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationSqlService.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Remove-AzDataMigrationSqlService' { - It 'Delete' { + It 'Delete' -skip { $count1 = (Get-AzDataMigrationSqlService -ResourceGroupName $env.TestNewSqlMigrationService.GroupName).count Remove-AzDataMigrationSqlService -Name $env.TestNewSqlMigrationService.SqlMigrationServiceName -ResourceGroupName $env.TestNewSqlMigrationService.GroupName $count2 = (Get-AzDataMigrationSqlService -ResourceGroupName $env.TestNewSqlMigrationService.GroupName).count diff --git a/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationSqlServiceNode.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationSqlServiceNode.Tests.ps1 index 2af3b9d62afe..3090b7b360cb 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationSqlServiceNode.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationSqlServiceNode.Tests.ps1 @@ -12,7 +12,7 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Remove-AzDataMigrationSqlServiceNode' { - It 'DeleteExpanded' { + It 'DeleteExpanded' -skip { $temp = Get-AzDataMigrationSqlServiceIntegrationRuntimeMetric -ResourceGroupName $env.RemoveNode.GroupName -SqlMigrationServiceName $env.RemoveNode.SqlMigrationServiceName $nodeList = $temp.Node $cnt1 = $nodeList.Count diff --git a/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationToSqlDb.Recording.json b/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationToSqlDb.Recording.json new file mode 100644 index 000000000000..88162f004000 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationToSqlDb.Recording.json @@ -0,0 +1,206 @@ +{ + "Remove-AzDataMigrationToSqlDb+[NoContext]+Delete+$PUT+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1?api-version=2022-03-30-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1?api-version=2022-03-30-preview", + "Content": "{\r\n \"properties\": {\r\n \"sourceSqlConnection\": {\r\n \"dataSource\": \"server.microsoft.com\",\r\n \"authentication\": \"SqlAuthentication\",\r\n \"userName\": \"hijavatestuser1\",\r\n \"password\": \"admin123\"\r\n },\r\n \"scope\": \"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\r\n \"sourceDatabaseName\": \"AdventureWorks\",\r\n \"migrationService\": \"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/dms20211030\",\r\n \"targetSqlConnection\": {\r\n \"dataSource\": \"target.windows.net\",\r\n \"authentication\": \"SqlAuthentication\",\r\n \"userName\": \"user\",\r\n \"password\": \"password\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "807" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/createsqldbmigration/operationResults/7e51d7ab-e5ab-4f67-94f5-6c2e7b8e0db9?api-version=2022-03-30-preview" ], + "x-ms-request-id": [ "cac6b5f1-3650-448b-ad77-fdb2aeaee0bb" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "x-ms-correlation-request-id": [ "953202bc-520c-4a17-b1dd-e25c860e9863" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220404T103133Z:953202bc-520c-4a17-b1dd-e25c860e9863" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 04 Apr 2022 10:31:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "833" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Creating\",\"sourceServerName\":\"server.microsoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1\",\"name\":\"at_sqldbtrgt1\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Remove-AzDataMigrationToSqlDb+[NoContext]+Delete+$GET+https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/createsqldbmigration/operationResults/7e51d7ab-e5ab-4f67-94f5-6c2e7b8e0db9?api-version=2022-03-30-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/createsqldbmigration/operationResults/7e51d7ab-e5ab-4f67-94f5-6c2e7b8e0db9?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "0d3e3121-f52a-4383-bc55-a4f0a47653f7" ], + "CommandName": [ "New-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "New-AzDataMigrationToSqlDb_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "15" ], + "x-ms-request-id": [ "4b315486-fd28-4443-a606-b3c1721b0062" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], + "x-ms-correlation-request-id": [ "3135e31c-0d69-4fda-8e95-e8f00f0efa4b" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220404T103148Z:3135e31c-0d69-4fda-8e95-e8f00f0efa4b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 04 Apr 2022 10:31:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "107" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"7e51d7ab-e5ab-4f67-94f5-6c2e7b8e0db9\",\"status\":\"Succeeded\",\"startTime\":\"2022-04-04T10:31:32.337Z\"}", + "isContentBase64": false + } + }, + "Remove-AzDataMigrationToSqlDb+[NoContext]+Delete+$GET+https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1?api-version=2022-03-30-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "0d3e3121-f52a-4383-bc55-a4f0a47653f7" ], + "CommandName": [ "New-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "New-AzDataMigrationToSqlDb_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "ee3f8a6e-f21f-4bed-b415-3c1ec23a4a17" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "x-ms-correlation-request-id": [ "77fbad8c-7722-41af-9590-5da7462d69a7" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220404T103149Z:77fbad8c-7722-41af-9590-5da7462d69a7" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 04 Apr 2022 10:31:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "966" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Succeeded\",\"migrationStatus\":\"InProgress\",\"startedOn\":\"2022-04-04T10:31:44.383Z\",\"sourceServerName\":\"server.microsoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"329ba898-25cc-4c55-aa91-361482c6d82d\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1\",\"name\":\"at_sqldbtrgt1\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Remove-AzDataMigrationToSqlDb+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1?force=True\u0026api-version=2022-03-30-preview+4": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1?force=True\u0026api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "77bae725-5327-43a5-aedc-51d8c900c6b4" ], + "CommandName": [ "Remove-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Remove-AzDataMigrationToSqlDb_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/dropsqldbmigration/operationResults/ea8a014b-27a8-4961-bcfb-2c08cd2c343c?api-version=2022-03-30-preview" ], + "x-ms-request-id": [ "49cfb2d7-39c3-402a-8716-823e0b01e677" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14998" ], + "x-ms-correlation-request-id": [ "425d3eca-b73e-4833-9924-37bf47eb9448" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220404T103155Z:425d3eca-b73e-4833-9924-37bf47eb9448" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 04 Apr 2022 10:31:54 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Remove-AzDataMigrationToSqlDb+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1?api-version=2022-03-30-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt1?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "56f7056c-b88c-42b6-95b0-d8102f84896c" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 404, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "274d4ba1-206e-4ada-92c5-e00ae09e3d6b" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "x-ms-correlation-request-id": [ "0885d64d-c6b7-4c0d-887e-0540ab7e83fc" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220404T103201Z:0885d64d-c6b7-4c0d-887e-0540ab7e83fc" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 04 Apr 2022 10:32:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "94" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"error\":{\"code\":\"ResourceDoesNotExist\",\"message\":\"Resource \u0027at_sqldbtrgt1\u0027 does not exist.\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationToSqlDb.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationToSqlDb.Tests.ps1 new file mode 100644 index 000000000000..9142ff6b2617 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/test/Remove-AzDataMigrationToSqlDb.Tests.ps1 @@ -0,0 +1,42 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzDataMigrationToSqlDb')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzDataMigrationToSqlDb.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzDataMigrationToSqlDb' { + It 'Delete' { + $targetPassword = ConvertTo-SecureString $env.TestDeleteDatabaseMigrationDb.TargetSqlConnectionPassword -AsPlainText -Force + $sourcePassword = ConvertTo-SecureString $env.TestDeleteDatabaseMigrationDb.SourceSqlConnectionPassword -AsPlainText -Force + + $instance = New-AzDataMigrationToSqlDb -ResourceGroupName $env.TestDeleteDatabaseMigrationDb.ResourceGroupName -SqlDbInstanceName $env.TestDeleteDatabaseMigrationDb.SqlDbInstanceName -MigrationService $env.TestDeleteDatabaseMigrationDb.MigrationService -TargetSqlConnectionAuthentication $env.TestDeleteDatabaseMigrationDb.TargetSqlConnectionAuthentication -TargetSqlConnectionDataSource $env.TestDeleteDatabaseMigrationDb.TargetSqlConnectionDataSource -TargetSqlConnectionPassword $targetPassword -TargetSqlConnectionUserName $env.TestDeleteDatabaseMigrationDb.TargetSqlConnectionUserName -SourceSqlConnectionAuthentication $env.TestDeleteDatabaseMigrationDb.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestDeleteDatabaseMigrationDb.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestDeleteDatabaseMigrationDb.SourceSqlConnectionUserName -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName $env.TestDeleteDatabaseMigrationDb.SourceDatabaseName -TargetDbName $env.TestDeleteDatabaseMigrationDb.TargetDbName -Scope $env.TestDeleteDatabaseMigrationDb.Scope + + Start-Sleep -Seconds 5 + + Remove-AzDataMigrationToSqlDb -ResourceGroupName $env.TestDeleteDatabaseMigrationDb.ResourceGroupName -SqlDbInstanceName $env.TestDeleteDatabaseMigrationDb.SqlDbInstanceName -TargetDbName $env.TestDeleteDatabaseMigrationDb.TargetDbName -Force + + Start-Sleep -Seconds 5 + + + $dbMig = Get-AzDataMigrationToSqlDb -ResourceGroupName $env.TestDeleteDatabaseMigrationDb.ResourceGroupName -SqlDbInstanceName $env.TestDeleteDatabaseMigrationDb.SqlDbInstanceName -TargetDbName $env.TestDeleteDatabaseMigrationDb.TargetDbName -ErrorAction SilentlyContinue + + + $assert = ($dbMig -eq $null) + $assert | Should be $true + + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlDb.Recording.json b/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlDb.Recording.json new file mode 100644 index 000000000000..38f2cebc8abb --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlDb.Recording.json @@ -0,0 +1,530 @@ +{ + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$PUT+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": "{\r\n \"properties\": {\r\n \"sourceSqlConnection\": {\r\n \"dataSource\": \"server.mivrosoft.com\",\r\n \"authentication\": \"SqlAuthentication\",\r\n \"userName\": \"hijavatestuser1\",\r\n \"password\": \"admin\"\r\n },\r\n \"scope\": \"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\r\n \"sourceDatabaseName\": \"AdventureWorks\",\r\n \"migrationService\": \"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/dms20211030\",\r\n \"targetSqlConnection\": {\r\n \"dataSource\": \"targetserver.windows.net\",\r\n \"authentication\": \"SqlAuthentication\",\r\n \"userName\": \"user1\",\r\n \"password\": \"password\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "807" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/createsqldbmigration/operationResults/b373cc4a-263f-4ecc-b888-3f3ccb2ffc77?api-version=2022-03-30-preview" ], + "x-ms-request-id": [ "90f78e65-d8ba-4e13-9f74-07d8721dd3de" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "x-ms-correlation-request-id": [ "d25a8466-9279-421d-9793-b390e69d018c" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113841Z:d25a8466-9279-421d-9793-b390e69d018c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:38:41 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "833" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Creating\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/createsqldbmigration/operationResults/b373cc4a-263f-4ecc-b888-3f3ccb2ffc77?api-version=2022-03-30-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/createsqldbmigration/operationResults/b373cc4a-263f-4ecc-b888-3f3ccb2ffc77?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "dc71ce2d-e16c-4c38-bd35-612a932b3df9" ], + "CommandName": [ "New-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "New-AzDataMigrationToSqlDb_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "15" ], + "x-ms-request-id": [ "85c0364d-cc8f-4ef4-812c-e288756f69a7" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11996" ], + "x-ms-correlation-request-id": [ "882fa7e5-751a-4991-9c01-07bf3990b0db" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113856Z:882fa7e5-751a-4991-9c01-07bf3990b0db" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:38:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "107" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"b373cc4a-263f-4ecc-b888-3f3ccb2ffc77\",\"status\":\"Succeeded\",\"startTime\":\"2022-03-30T11:38:40.043Z\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "dc71ce2d-e16c-4c38-bd35-612a932b3df9" ], + "CommandName": [ "New-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "New-AzDataMigrationToSqlDb_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "2e818cd4-5bac-4478-bdfd-b49678cd4a1c" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11995" ], + "x-ms-correlation-request-id": [ "a379ba24-f8f5-40a2-804a-580bfe0868ad" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113856Z:a379ba24-f8f5-40a2-804a-580bfe0868ad" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:38:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "965" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Succeeded\",\"migrationStatus\":\"InProgress\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "90756f2d-d620-4a73-9f4e-02fec8bed74e" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "61cf88ee-13dc-4195-895d-7d03483930a7" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], + "x-ms-correlation-request-id": [ "51ab7796-3b2f-45ea-a5ff-8805721093fd" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113858Z:51ab7796-3b2f-45ea-a5ff-8805721093fd" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:38:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "965" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Succeeded\",\"migrationStatus\":\"InProgress\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$POST+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2/cancel?api-version=2022-03-30-preview+5": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2/cancel?api-version=2022-03-30-preview", + "Content": "{\r\n \"migrationOperationId\": \"d0998fa9-1b73-4242-8f73-28ab2de2779f\"\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "70" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/providers/Microsoft.DataMigration/locations/eastus2euap/operationTypes/cancelsqldbmigration/operationResults/59023a50-c585-4e0c-9fcb-95a677a86b9b?api-version=2022-03-30-preview" ], + "x-ms-request-id": [ "b8bd8528-eb45-4bb8-a836-24ad07e76eaf" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-correlation-request-id": [ "7fba2e51-68bb-4a1f-856b-327584887d72" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113900Z:7fba2e51-68bb-4a1f-856b-327584887d72" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:38:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "670" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Canceling\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "10" ], + "x-ms-client-request-id": [ "34d05151-0cc6-41bf-b84e-d7d82268933a" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "86e29a5c-6a99-4f75-93eb-dd1e1e947c1d" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "x-ms-correlation-request-id": [ "d1d0362a-d7d6-4265-a7c5-0e9b0b0a0c02" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113901Z:d1d0362a-d7d6-4265-a7c5-0e9b0b0a0c02" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:39:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "964" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Canceling\",\"migrationStatus\":\"Canceling\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "11" ], + "x-ms-client-request-id": [ "b46984c2-85de-43a8-bd8c-0a2a86340611" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "55a171ca-6a8e-42d4-bfa7-107c13b54ef9" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "x-ms-correlation-request-id": [ "a4b75a20-c4c3-4acb-b8f9-1e8ac7a32275" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113902Z:a4b75a20-c4c3-4acb-b8f9-1e8ac7a32275" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:39:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "964" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Canceling\",\"migrationStatus\":\"Canceling\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "12" ], + "x-ms-client-request-id": [ "77c1d4e7-282f-4523-afa6-9bcf218fbf34" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "66a6392a-2aaf-4686-b31c-f61255307063" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11991" ], + "x-ms-correlation-request-id": [ "e823a7f2-f823-44e2-9636-30bdabb3f299" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113903Z:e823a7f2-f823-44e2-9636-30bdabb3f299" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:39:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "964" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Canceling\",\"migrationStatus\":\"Canceling\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "13" ], + "x-ms-client-request-id": [ "ed4eec87-69e8-43de-8f43-c3874b27c6a6" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "7c6747e0-d159-4cd2-a833-ba39e9ab0d86" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11990" ], + "x-ms-correlation-request-id": [ "68de19a9-d258-4a6d-a314-d36cfa1b4ef6" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113904Z:68de19a9-d258-4a6d-a314-d36cfa1b4ef6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:39:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "964" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Canceling\",\"migrationStatus\":\"Canceling\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "14" ], + "x-ms-client-request-id": [ "45429403-eaa0-46b5-a291-e465d3153b96" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "2f5d02c8-a966-431f-bb67-f2bfec0fe574" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11989" ], + "x-ms-correlation-request-id": [ "d4e0f50a-e3ef-4f7c-8c7b-5a06e8eff73d" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113905Z:d4e0f50a-e3ef-4f7c-8c7b-5a06e8eff73d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:39:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "964" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Canceling\",\"migrationStatus\":\"Canceling\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "15" ], + "x-ms-client-request-id": [ "f8fde2e1-e6fe-4f55-afb4-dcbb9b7198e7" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "ab2c15dc-369b-4931-aa11-046625f37916" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11988" ], + "x-ms-correlation-request-id": [ "0d134755-fb0b-4add-b905-1d55b4179396" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113905Z:0d134755-fb0b-4add-b905-1d55b4179396" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:39:05 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "964" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Canceling\",\"migrationStatus\":\"Canceling\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "16" ], + "x-ms-client-request-id": [ "7af0349e-fbec-4306-916e-558d01eb896a" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "fec88bbf-5d30-4e4e-8e79-aed3567b026a" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11987" ], + "x-ms-correlation-request-id": [ "b00a3893-fffd-45df-a696-c06a9e2b94a9" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113906Z:b00a3893-fffd-45df-a696-c06a9e2b94a9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:39:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "964" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Canceling\",\"migrationStatus\":\"Canceling\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + }, + "Stop-AzDataMigrationToSqlDb+[NoContext]+CancelExpanded+$GET+https://management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://eastus2euap.management.azure.com/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2?api-version=2022-03-30-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "17" ], + "x-ms-client-request-id": [ "22c4ced4-d269-4b9b-9ae3-a1507b8e5dad" ], + "CommandName": [ "Get-AzDataMigrationToSqlDb" ], + "FullCommandName": [ "Get-AzDataMigrationToSqlDb_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "Az.DataMigration/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "f7c9eb17-fb75-4974-bfc7-6e740469432b" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11986" ], + "x-ms-correlation-request-id": [ "8e45b9dc-efaf-4b0c-b63c-50d7d81ff501" ], + "x-ms-routing-request-id": [ "EASTUS2EUAP:20220330T113907Z:8e45b9dc-efaf-4b0c-b63c-50d7d81ff501" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Wed, 30 Mar 2022 11:39:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "999" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"offlineConfiguration\":{\"offline\":true},\"backupConfiguration\":{\"sourceLocation\":{\"fileStorageType\":\"None\"}},\"scope\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb\",\"provisioningState\":\"Succeeded\",\"migrationStatus\":\"Canceled\",\"startedOn\":\"2022-03-30T11:38:53.59Z\",\"endedOn\":\"2022-03-30T11:39:07.34Z\",\"sourceServerName\":\"server.mivrosoft.com\",\"sourceDatabaseName\":\"AdventureWorks\",\"migrationService\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/sqlMigrationServices/dms20211030\",\"migrationOperationId\":\"d0998fa9-1b73-4242-8f73-28ab2de2779f\",\"kind\":\"SqlDb\"},\"id\":\"/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb/providers/Microsoft.DataMigration/databaseMigrations/at_sqldbtrgt2\",\"name\":\"at_sqldbtrgt2\",\"type\":\"Microsoft.DataMigration/databaseMigrations\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlDb.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlDb.Tests.ps1 new file mode 100644 index 000000000000..669c81988d11 --- /dev/null +++ b/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlDb.Tests.ps1 @@ -0,0 +1,38 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Stop-AzDataMigrationToSqlDb')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Stop-AzDataMigrationToSqlDb.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Stop-AzDataMigrationToSqlDb' { + It 'CancelExpanded' -skip { + $targetPassword = ConvertTo-SecureString $env.TestStopDatabaseMigrationDb.TargetSqlConnectionPassword -AsPlainText -Force + $sourcePassword = ConvertTo-SecureString $env.TestStopDatabaseMigrationDb.SourceSqlConnectionPassword -AsPlainText -Force + + $instance = New-AzDataMigrationToSqlDb -ResourceGroupName $env.TestStopDatabaseMigrationDb.ResourceGroupName -SqlDbInstanceName $env.TestStopDatabaseMigrationDb.SqlDbInstanceName -MigrationService $env.TestStopDatabaseMigrationDb.MigrationService -TargetSqlConnectionAuthentication $env.TestStopDatabaseMigrationDb.TargetSqlConnectionAuthentication -TargetSqlConnectionDataSource $env.TestStopDatabaseMigrationDb.TargetSqlConnectionDataSource -TargetSqlConnectionPassword $targetPassword -TargetSqlConnectionUserName $env.TestStopDatabaseMigrationDb.TargetSqlConnectionUserName -SourceSqlConnectionAuthentication $env.TestStopDatabaseMigrationDb.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestStopDatabaseMigrationDb.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestStopDatabaseMigrationDb.SourceSqlConnectionUserName -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName $env.TestStopDatabaseMigrationDb.SourceDatabaseName -TargetDbName $env.TestStopDatabaseMigrationDb.TargetDbName -Scope $env.TestStopDatabaseMigrationDb.Scope + + $details = Get-AzDataMigrationToSqlDb -SqlDbInstanceName $env.TestStopDatabaseMigrationDb.SqlDbInstanceName -ResourceGroupName $env.TestStopDatabaseMigrationDb.ResourceGroupName -TargetDbName $env.TestStopDatabaseMigrationDb.TargetDbName + + Stop-AzDataMigrationToSqlDb -ResourceGroupName $env.TestStopDatabaseMigrationDb.ResourceGroupName -SqlDbInstanceName $env.TestStopDatabaseMigrationDb.SqlDbInstanceName -TargetDbName $env.TestStopDatabaseMigrationDb.TargetDbName -MigrationOperationId $details.MigrationOperationId + + $details = Get-AzDataMigrationToSqlDb -SqlDbInstanceName $env.TestStopDatabaseMigrationDb.SqlDbInstanceName -ResourceGroupName $env.TestStopDatabaseMigrationDb.ResourceGroupName -TargetDbName $env.TestStopDatabaseMigrationDb.TargetDbName + + While($details.MigrationStatus -eq "Canceling") + { + $details = Get-AzDataMigrationToSqlDb -SqlDbInstanceName $env.TestStopDatabaseMigrationDb.SqlDbInstanceName -ResourceGroupName $env.TestStopDatabaseMigrationDb.ResourceGroupName -TargetDbName $env.TestStopDatabaseMigrationDb.TargetDbName + + } + $assert = ($details.MigrationStatus -eq "Canceled") + $assert | should be $true + } +} diff --git a/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlManagedInstance.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlManagedInstance.Tests.ps1 index 83bcd62344dc..1ad4b877b771 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlManagedInstance.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlManagedInstance.Tests.ps1 @@ -12,8 +12,11 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Stop-AzDataMigrationToSqlManagedInstance' { - It 'CancelExpanded' { - $instance = New-AzDataMigrationToSqlManagedInstance -ResourceGroupName $env.TestStopDatabaseMigrationMi.ResourceGroupName -ManagedInstanceName $env.TestStopDatabaseMigrationMi.ManagedInstanceName -TargetDbName $env.TestStopDatabaseMigrationMi.TargetDbName -Kind $env.TestStopDatabaseMigrationMi.Kind -Scope $env.TestStopDatabaseMigrationMi.Scope -MigrationService $env.TestStopDatabaseMigrationMi.MigrationService -StorageAccountResourceId $env.TestStopDatabaseMigrationMi.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestStopDatabaseMigrationMi.TargetLocationAccountKey -FileSharePath $env.TestStopDatabaseMigrationMi.FileSharePath -FileShareUsername $env.TestStopDatabaseMigrationMi.FileShareUsername -FileSharePassword $env.TestStopDatabaseMigrationMi.FileSharePassword -SourceSqlConnectionAuthentication $env.TestStopDatabaseMigrationMi.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestStopDatabaseMigrationMi.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestStopDatabaseMigrationMi.SourceSqlConnectionUsername -SourceSqlConnectionPassword $env.TestStopDatabaseMigrationMi.SourceSqlConnectionPassword -SourceDatabaseName $env.TestStopDatabaseMigrationMi.SourceDatabaseName + It 'CancelExpanded' -skip { + $filesharePassword = ConvertTo-SecureString $env.TestStopDatabaseMigrationMi.FileSharePassword -AsPlainText -Force + $sourcePassword = ConvertTo-SecureString $env.TestStopDatabaseMigrationMi.SourceSqlConnectionPassword -AsPlainText -Force + + $instance = New-AzDataMigrationToSqlManagedInstance -ResourceGroupName $env.TestStopDatabaseMigrationMi.ResourceGroupName -ManagedInstanceName $env.TestStopDatabaseMigrationMi.ManagedInstanceName -TargetDbName $env.TestStopDatabaseMigrationMi.TargetDbName -Kind $env.TestStopDatabaseMigrationMi.Kind -Scope $env.TestStopDatabaseMigrationMi.Scope -MigrationService $env.TestStopDatabaseMigrationMi.MigrationService -StorageAccountResourceId $env.TestStopDatabaseMigrationMi.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestStopDatabaseMigrationMi.TargetLocationAccountKey -FileSharePath $env.TestStopDatabaseMigrationMi.FileSharePath -FileShareUsername $env.TestStopDatabaseMigrationMi.FileShareUsername -FileSharePassword $filesharePassword -SourceSqlConnectionAuthentication $env.TestStopDatabaseMigrationMi.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestStopDatabaseMigrationMi.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestStopDatabaseMigrationMi.SourceSqlConnectionUsername -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName $env.TestStopDatabaseMigrationMi.SourceDatabaseName $details = Get-AzDataMigrationToSqlManagedInstance -ManagedInstanceName $env.TestStopDatabaseMigrationMi.ManagedInstanceName -ResourceGroupName $env.TestStopDatabaseMigrationMi.ResourceGroupName -TargetDbName $env.TestStopDatabaseMigrationMi.TargetDbName Stop-AzDataMigrationToSqlManagedInstance -MigrationOperationId $details.MigrationOperationId -ManagedInstanceName $env.TestStopDatabaseMigrationMi.ManagedInstanceName -ResourceGroupName $env.TestStopDatabaseMigrationMi.ResourceGroupName -TargetDbName $env.TestStopDatabaseMigrationMi.TargetDbName $details = Get-AzDataMigrationToSqlManagedInstance -ManagedInstanceName $env.TestStopDatabaseMigrationMi.ManagedInstanceName -ResourceGroupName $env.TestStopDatabaseMigrationMi.ResourceGroupName -TargetDbName $env.TestStopDatabaseMigrationMi.TargetDbName diff --git a/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlVM.Tests.ps1 b/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlVM.Tests.ps1 index 022229611353..1a506163ffee 100644 --- a/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlVM.Tests.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/Stop-AzDataMigrationToSqlVM.Tests.ps1 @@ -12,8 +12,11 @@ while(-not $mockingPath) { . ($mockingPath | Select-Object -First 1).FullName Describe 'Stop-AzDataMigrationToSqlVM' { - It 'CancelExpanded' { - $instance = New-AzDataMigrationToSqlVM -ResourceGroupName $env.TestStopDatabaseMigrationVm.ResourceGroupName -SqlVirtualMachineName $env.TestStopDatabaseMigrationVm.SqlVirtualMachineName -TargetDbName $env.TestStopDatabaseMigrationVm.TargetDbName -Kind $env.TestStopDatabaseMigrationVm.Kind -Scope $env.TestStopDatabaseMigrationVm.Scope -MigrationService $env.TestStopDatabaseMigrationVm.MigrationService -StorageAccountResourceId $env.TestStopDatabaseMigrationVm.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestStopDatabaseMigrationVm.TargetLocationAccountKey -FileSharePath $env.TestStopDatabaseMigrationVm.FileSharePath -FileShareUsername $env.TestStopDatabaseMigrationVm.FileShareUsername -FileSharePassword $env.TestStopDatabaseMigrationVm.FileSharePassword -SourceSqlConnectionAuthentication $env.TestStopDatabaseMigrationVm.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestStopDatabaseMigrationVm.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestStopDatabaseMigrationVm.SourceSqlConnectionUsername -SourceSqlConnectionPassword $env.TestStopDatabaseMigrationVm.SourceSqlConnectionPassword -SourceDatabaseName $env.TestStopDatabaseMigrationVm.SourceDatabaseName + It 'CancelExpanded' -skip { + $filesharePassword = ConvertTo-SecureString $env.TestStopDatabaseMigrationVm.FileSharePassword -AsPlainText -Force + $sourcePassword = ConvertTo-SecureString $env.TestStopDatabaseMigrationVm.SourceSqlConnectionPassword -AsPlainText -Force + + $instance = New-AzDataMigrationToSqlVM -ResourceGroupName $env.TestStopDatabaseMigrationVm.ResourceGroupName -SqlVirtualMachineName $env.TestStopDatabaseMigrationVm.SqlVirtualMachineName -TargetDbName $env.TestStopDatabaseMigrationVm.TargetDbName -Kind $env.TestStopDatabaseMigrationVm.Kind -Scope $env.TestStopDatabaseMigrationVm.Scope -MigrationService $env.TestStopDatabaseMigrationVm.MigrationService -StorageAccountResourceId $env.TestStopDatabaseMigrationVm.TargetLocationStorageAccountResourceId -StorageAccountKey $env.TestStopDatabaseMigrationVm.TargetLocationAccountKey -FileSharePath $env.TestStopDatabaseMigrationVm.FileSharePath -FileShareUsername $env.TestStopDatabaseMigrationVm.FileShareUsername -FileSharePassword $filesharePassword -SourceSqlConnectionAuthentication $env.TestStopDatabaseMigrationVm.SourceSqlConnectionAuthentication -SourceSqlConnectionDataSource $env.TestStopDatabaseMigrationVm.SourceSqlConnectionDataSource -SourceSqlConnectionUserName $env.TestStopDatabaseMigrationVm.SourceSqlConnectionUsername -SourceSqlConnectionPassword $sourcePassword -SourceDatabaseName $env.TestStopDatabaseMigrationVm.SourceDatabaseName $details = Get-AzDataMigrationToSqlVM -SqlVirtualMachineName $env.TestStopDatabaseMigrationVm.SqlVirtualMachineName -ResourceGroupName $env.TestStopDatabaseMigrationVm.ResourceGroupName -TargetDbName $env.TestStopDatabaseMigrationVm.TargetDbName Stop-AzDataMigrationToSqlVM -MigrationOperationId $details.MigrationOperationId -SqlVirtualMachineName $env.TestStopDatabaseMigrationVm.SqlVirtualMachineName -ResourceGroupName $env.TestStopDatabaseMigrationVm.ResourceGroupName -TargetDbName $env.TestStopDatabaseMigrationVm.TargetDbName $details = Get-AzDataMigrationToSqlVM -SqlVirtualMachineName $env.TestStopDatabaseMigrationVm.SqlVirtualMachineName -ResourceGroupName $env.TestStopDatabaseMigrationVm.ResourceGroupName -TargetDbName $env.TestStopDatabaseMigrationVm.TargetDbName diff --git a/src/DataMigration/DataMigration.Autorest/test/env.json b/src/DataMigration/DataMigration.Autorest/test/env.json index 6a37006198ac..e59f80df280b 100644 --- a/src/DataMigration/DataMigration.Autorest/test/env.json +++ b/src/DataMigration/DataMigration.Autorest/test/env.json @@ -1,139 +1,193 @@ { - "TestAuthKey": { - "SqlMigrationServiceName": "alias-dms", - "GroupName": "tsum38RG" + "TestNewDatabaseMigrationDb": { + "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb", + "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/dms20211030", + "TargetDbName": "at_sqldbtrgt3", + "TargetSqlConnectionUserName": "username", + "TargetSqlConnectionDataSource": "db.windows.net", + "SourceSqlConnectionDataSource": "sampledomain.microsoft.com", + "SourceSqlConnectionUserName": "user", + "TargetSqlConnectionPassword": "password", + "SqlDbInstanceName": "dmstestsqldb", + "TargetSqlConnectionAuthentication": "SqlAuthentication", + "ResourceGroupName": "tsum38RG", + "Kind": "SqlDb", + "SourceSqlConnectionAuthentication": "SqlAuthentication", + "SourceSqlConnectionPassword": "password", + "SourceDatabaseName": "AdventureWorks" }, - "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "TestDatabaseMigrationVm": { - "SqlVirtualMachineName": "unitTest", - "TargetDbName": "unitTestVm", + "TestDatabaseMigrationDb": { + "SqlDbInstanceName": "dmstestsqldb", + "TargetDbName": "at_sqldbtrgt3", "ResourceGroupName": "tsum38RG" }, - "TestCutDatabaseMigrationVm": { - "Kind": "SqlVm", - "FileSharePassword": "domainPassword", - "FileShareUsername": "domainUserName", + "SubscriptionId": "f133ff51-53dc-4486-a487-47049d50ab9e", + "TestStopDatabaseMigrationVm": { "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/unitTest", - "SourceSqlConnectionUserName": "domainUserName", - "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/alias", - "SourceSqlConnectionPassword": "domainPassword", - "SourceSqlConnectionAuthentication": "SqlAuthentication", - "SqlVirtualMachineName": "unitTest", - "TargetDbName": "VmUnitTestCut0k8lo2sr57", - "ResourceGroupName": "tsum38RG", + "TargetDbName": "VmUnitTestStopblvr5sxzj6", "FileSharePath": "\\\\sampledomain.onmicrosoft.com\\SharedBackup\\tsuman", - "SourceDatabaseName": "AdventureWorks", - "SourceSqlConnectionDataSource": "sampledomain.onmicrosoft.com", - "TargetLocationAccountKey": "accountKey" - }, - "TestStopDatabaseMigrationVm": { - "Kind": "SqlVm", - "FileSharePassword": "domainPassword", + "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", "FileShareUsername": "domainUserName", - "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/unitTest", + "SourceSqlConnectionDataSource": "sampledomain.onmicrosoft.com", + "TargetLocationAccountKey": "accountKey", + "SourceDatabaseName": "AdventureWorks", "SourceSqlConnectionUserName": "domainUserName", - "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", - "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/alias", - "SourceSqlConnectionPassword": "domainPassword", - "SourceSqlConnectionAuthentication": "SqlAuthentication", + "ResourceGroupName": "tsum38RG", "SqlVirtualMachineName": "unitTest", - "TargetDbName": "VmUnitTestStop0k8lo2sr57", + "Kind": "SqlVm", + "SourceSqlConnectionAuthentication": "SqlAuthentication", + "SourceSqlConnectionPassword": "domainPassword", + "FileSharePassword": "domainPassword" + }, + "TestDeleteDatabaseMigrationDb": { + "TargetDbName": "at_sqldbtrgt1", + "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/dms20211030", + "TargetSqlConnectionDataSource": "db.windows.net", + "TargetSqlConnectionUserName": "username", + "SourceSqlConnectionDataSource": "sampledomain.microsoft.com", + "SourceSqlConnectionUserName": "user", + "TargetSqlConnectionPassword": "password", + "SqlDbInstanceName": "dmstestsqldb", + "TargetSqlConnectionAuthentication": "SqlAuthentication", "ResourceGroupName": "tsum38RG", + "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb", + "SourceSqlConnectionAuthentication": "SqlAuthentication", + "SourceSqlConnectionPassword": "password", + "SourceDatabaseName": "AdventureWorks" + }, + "TestSqlMigrationService": { + "SqlMigrationServiceName": "trialTD", + "GroupName": "tsum38RG" + }, + "TestStopDatabaseMigrationMi": { + "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/MigrationTesting/providers/Microsoft.Sql/managedInstances/migrationtestmi", + "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/alias", + "TargetDbName": "MiUnitTestStopblvr5sxzj6", "FileSharePath": "\\\\sampledomain.onmicrosoft.com\\SharedBackup\\tsuman", - "SourceDatabaseName": "AdventureWorks", + "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", + "FileShareUsername": "domainUserName", + "SourceSqlConnectionAuthentication": "SqlAuthentication", "SourceSqlConnectionDataSource": "sampledomain.onmicrosoft.com", - "TargetLocationAccountKey": "accountKey" - }, - "TestNewSqlMigrationService": { - "GroupName": "tsum38RG", - "SqlMigrationServiceName": "new-testing-sqlmigrationservice-0k8lo2sr57", - "Location": "eastus" + "TargetLocationAccountKey": "accountKey", + "SourceDatabaseName": "AdventureWorks", + "SourceSqlConnectionUserName": "domainUserName", + "ResourceGroupName": "migrationTesting", + "Kind": "SqlMi", + "ManagedInstanceName": "migrationtestmi", + "SourceSqlConnectionPassword": "domainPassword", + "FileSharePassword": "domainPassword" }, + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", "RemoveNode": { "SqlMigrationServiceName": "dms20211030", "GroupName": "tsum38RG" }, - "TestNewDatabaseMigrationVm": { - "Kind": "SqlVm", - "FileSharePassword": "domainPassword", - "FileShareUsername": "domainUserName", - "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/unitTest", - "SourceSqlConnectionUserName": "domainUserName", - "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", + "TestCutDatabaseMigrationMi": { + "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/MigrationTesting/providers/Microsoft.Sql/managedInstances/migrationtestmi", "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/alias", - "SourceSqlConnectionPassword": "domainPassword", - "SourceSqlConnectionAuthentication": "SqlAuthentication", - "SqlVirtualMachineName": "unitTest", - "TargetDbName": "VmUnitTest0k8lo2sr57", - "ResourceGroupName": "tsum38RG", + "TargetDbName": "MiUnitTestCutblvr5sxzj6", "FileSharePath": "\\\\sampledomain.onmicrosoft.com\\SharedBackup\\tsuman", - "SourceDatabaseName": "AdventureWorks", + "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", + "FileShareUsername": "domainUserName", + "SourceSqlConnectionAuthentication": "SqlAuthentication", "SourceSqlConnectionDataSource": "sampledomain.onmicrosoft.com", - "TargetLocationAccountKey": "accountKey" + "TargetLocationAccountKey": "accountKey", + "SourceDatabaseName": "AdventureWorks", + "SourceSqlConnectionUserName": "domainUserName", + "ResourceGroupName": "migrationTesting", + "Kind": "SqlMi", + "ManagedInstanceName": "migrationtestmi", + "SourceSqlConnectionPassword": "domainPassword", + "FileSharePassword": "domainPassword" + }, + "TestAuthKey": { + "SqlMigrationServiceName": "alias-dms", + "GroupName": "tsum38RG" }, "TestDatabaseMigrationMi": { "TargetDbName": "discMiOn", "ManagedInstanceName": "migrationtestmi", "ResourceGroupName": "MigrationTesting" }, - "TestCutDatabaseMigrationMi": { - "Kind": "SqlMi", - "FileSharePassword": "domainPassword", - "FileShareUsername": "domainUserName", - "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/MigrationTesting/providers/Microsoft.Sql/managedInstances/migrationtestmi", - "SourceSqlConnectionUserName": "domainUserName", - "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", + "TestCutDatabaseMigrationVm": { + "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/unitTest", "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/alias", - "SourceSqlConnectionPassword": "domainPassword", - "SourceSqlConnectionAuthentication": "SqlAuthentication", - "TargetDbName": "MiUnitTestCut0k8lo2sr57", - "ResourceGroupName": "migrationTesting", - "ManagedInstanceName": "migrationtestmi", + "TargetDbName": "VmUnitTestCutblvr5sxzj6", "FileSharePath": "\\\\sampledomain.onmicrosoft.com\\SharedBackup\\tsuman", - "SourceDatabaseName": "AdventureWorks", + "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", + "FileShareUsername": "domainUserName", "SourceSqlConnectionDataSource": "sampledomain.onmicrosoft.com", - "TargetLocationAccountKey": "accountKey" + "TargetLocationAccountKey": "accountKey", + "SourceDatabaseName": "AdventureWorks", + "SourceSqlConnectionUserName": "domainUserName", + "ResourceGroupName": "tsum38RG", + "SqlVirtualMachineName": "unitTest", + "Kind": "SqlVm", + "SourceSqlConnectionAuthentication": "SqlAuthentication", + "SourceSqlConnectionPassword": "domainPassword", + "FileSharePassword": "domainPassword" }, - "TestStopDatabaseMigrationMi": { - "Kind": "SqlMi", - "FileSharePassword": "domainPassword", + "TestNewDatabaseMigrationVm": { + "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/unitTest", + "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/alias", + "TargetDbName": "VmUnitTestblvr5sxzj6", + "FileSharePath": "\\\\sampledomain.onmicrosoft.com\\SharedBackup\\tsuman", + "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", "FileShareUsername": "domainUserName", - "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/MigrationTesting/providers/Microsoft.Sql/managedInstances/migrationtestmi", + "SourceSqlConnectionDataSource": "sampledomain.onmicrosoft.com", + "TargetLocationAccountKey": "accountKey", + "SourceDatabaseName": "AdventureWorks", "SourceSqlConnectionUserName": "domainUserName", - "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", - "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/alias", + "ResourceGroupName": "tsum38RG", + "SqlVirtualMachineName": "unitTest", + "Kind": "SqlVm", + "SourceSqlConnectionAuthentication": "SqlAuthentication", "SourceSqlConnectionPassword": "domainPassword", + "FileSharePassword": "domainPassword" + }, + "TestDatabaseMigrationVm": { + "TargetDbName": "unitTestVm", + "SqlVirtualMachineName": "unitTest", + "ResourceGroupName": "tsum38RG" + }, + "TestStopDatabaseMigrationDb": { + "TargetDbName": "at_sqldbtrgt2", + "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/dms20211030", + "TargetSqlConnectionDataSource": "db.windows.net", + "TargetSqlConnectionUserName": "username", + "SourceSqlConnectionDataSource": "sampledomain.microsoft.com", + "SourceSqlConnectionUserName": "user", + "TargetSqlConnectionPassword": "password", + "SqlDbInstanceName": "dmstestsqldb", + "TargetSqlConnectionAuthentication": "SqlAuthentication", + "ResourceGroupName": "tsum38RG", + "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb", "SourceSqlConnectionAuthentication": "SqlAuthentication", - "TargetDbName": "MiUnitTestStop0k8lo2sr57", - "ResourceGroupName": "migrationTesting", - "ManagedInstanceName": "migrationtestmi", - "FileSharePath": "\\\\sampledomain.onmicrosoft.com\\SharedBackup\\tsuman", - "SourceDatabaseName": "AdventureWorks", - "SourceSqlConnectionDataSource": "sampledomain.onmicrosoft.com", - "TargetLocationAccountKey": "accountKey" + "SourceSqlConnectionPassword": "password", + "SourceDatabaseName": "AdventureWorks" + }, + "TestNewSqlMigrationService": { + "Location": "eastus", + "GroupName": "tsum38RG", + "SqlMigrationServiceName": "new-testing-sqlmigrationservice-blvr5sxzj6" }, "TestNewDatabaseMigrationMi": { - "Kind": "SqlMi", - "FileSharePassword": "domainPassword", - "FileShareUsername": "domainUserName", "Scope": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/MigrationTesting/providers/Microsoft.Sql/managedInstances/migrationtestmi", - "SourceSqlConnectionUserName": "domainUserName", - "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", "MigrationService": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/alias", - "SourceSqlConnectionPassword": "domainPassword", + "TargetDbName": "MiUnitTestblvr5sxzj6", + "FileSharePath": "\\\\sampledomain.onmicrosoft.com\\SharedBackup\\tsuman", + "TargetLocationStorageAccountResourceId": "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/aaskhan/providers/Microsoft.Storage/storageAccounts/aasimmigrationtest", + "FileShareUsername": "domainUserName", "SourceSqlConnectionAuthentication": "SqlAuthentication", - "TargetDbName": "MiUnitTest0k8lo2sr57", + "SourceSqlConnectionDataSource": "sampledomain.onmicrosoft.com", + "TargetLocationAccountKey": "accountKey", + "SourceDatabaseName": "AdventureWorks", + "SourceSqlConnectionUserName": "domainUserName", "ResourceGroupName": "migrationTesting", + "Kind": "SqlMi", "ManagedInstanceName": "migrationtestmi", - "FileSharePath": "\\\\sampledomain.onmicrosoft.com\\SharedBackup\\tsuman", - "SourceDatabaseName": "AdventureWorks", - "SourceSqlConnectionDataSource": "sampledomain.onmicrosoft.com", - "TargetLocationAccountKey": "accountKey" - }, - "TestSqlMigrationService": { - "SqlMigrationServiceName": "trialTD", - "GroupName": "tsum38RG" - }, - "SubscriptionId": "f133ff51-53dc-4486-a487-47049d50ab9e" + "SourceSqlConnectionPassword": "domainPassword", + "FileSharePassword": "domainPassword" + } } diff --git a/src/DataMigration/DataMigration.Autorest/test/loadEnv.ps1 b/src/DataMigration/DataMigration.Autorest/test/loadEnv.ps1 index c4ebf2e8310c..5f079e89615e 100644 --- a/src/DataMigration/DataMigration.Autorest/test/loadEnv.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/loadEnv.ps1 @@ -1,6 +1,5 @@ # ---------------------------------------------------------------------------------- -# -# Copyright Microsoft Corporation +# 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 @@ -10,6 +9,8 @@ # 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. # ---------------------------------------------------------------------------------- $envFile = 'env.json' if ($TestMode -eq 'live') { diff --git a/src/DataMigration/DataMigration.Autorest/test/utils.ps1 b/src/DataMigration/DataMigration.Autorest/test/utils.ps1 index 2a9e8be5fad3..beb0a1920b8f 100644 --- a/src/DataMigration/DataMigration.Autorest/test/utils.ps1 +++ b/src/DataMigration/DataMigration.Autorest/test/utils.ps1 @@ -11,18 +11,14 @@ function setupEnv() { # as default. You could change them if needed. $env.SubscriptionId = (Get-AzContext).Subscription.Id $env.Tenant = (Get-AzContext).Tenant.Id - - $SqlMigrationServiceTestVariables = @{ GroupName = "tsum38RG" SqlMigrationServiceName = "trialTD" } - $RemoveNode = @{ GroupName = "tsum38RG" SqlMigrationServiceName = "dms20211030" } - $randomstring = RandomString -allChars $false -len 10 $newSqlMigrationServiceName = "new-testing-sqlmigrationservice-" + $randomstring $NewSqlMigrationServiceTestVariables = @{ @@ -30,26 +26,26 @@ function setupEnv() { SqlMigrationServiceName = $newSqlMigrationServiceName Location = "eastus" } - $AuthKeyTestVariables = @{ GroupName = "tsum38RG" SqlMigrationServiceName = "alias-dms" } - $DatabaseMigrationTestVariablesMi = @{ ResourceGroupName = "MigrationTesting" ManagedInstanceName = "migrationtestmi" TargetDbName = "discMiOn" } - $DatabaseMigrationTestVariablesVm = @{ ResourceGroupName = "tsum38RG" SqlVirtualMachineName = "unitTest" TargetDbName = "unitTestVm" } - + $DatabaseMigrationTestVariablesDb = @{ + ResourceGroupName = "tsum38RG" + SqlDbInstanceName = "dmstestsqldb" + TargetDbName = "at_sqldbtrgt3" + } $newDatabaseMigrationNameMi = "MiUnitTest" + $randomstring - $NewDatabaseMigrationTestVariablesMi = @{ ResourceGroupName = "migrationTesting" ManagedInstanceName = "migrationtestmi" @@ -61,14 +57,13 @@ function setupEnv() { TargetLocationAccountKey = "accountKey" FileSharePath = "\\sampledomain.onmicrosoft.com\SharedBackup\tsuman" FileShareUsername = "domainUserName" - FileSharePassword = "domainPassword" + FileSharePassword = "password" SourceSqlConnectionAuthentication = "SqlAuthentication" SourceSqlConnectionDataSource = "sampledomain.onmicrosoft.com" SourceSqlConnectionUserName = "domainUserName" - SourceSqlConnectionPassword = "domainPassword" + SourceSqlConnectionPassword = "password" SourceDatabaseName = "AdventureWorks" } - $newDatabaseMigrationNameVm = "VmUnitTest" + $randomstring $NewDatabaseMigrationTestVariablesVm = @{ ResourceGroupName = "tsum38RG" @@ -81,16 +76,32 @@ function setupEnv() { TargetLocationAccountKey = "accountKey" FileSharePath = "\\sampledomain.onmicrosoft.com\SharedBackup\tsuman" FileShareUsername = "domainUserName" - FileSharePassword = "domainPassword" + FileSharePassword = "password" SourceSqlConnectionAuthentication = "SqlAuthentication" SourceSqlConnectionDataSource = "sampledomain.onmicrosoft.com" SourceSqlConnectionUserName = "domainUserName" - SourceSqlConnectionPassword = "domainPassword" + SourceSqlConnectionPassword = "password" SourceDatabaseName = "AdventureWorks" } + $NewDatabaseMigrationTestVariablesDb = @{ + ResourceGroupName = "tsum38RG" + SqlDbInstanceName = "dmstestsqldb" + TargetDbName = "at_sqldbtrgt3" + Kind = "SqlDb" + Scope = "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb" + MigrationService = "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/dms20211030" + TargetSqlConnectionAuthentication = "SqlAuthentication" + TargetSqlConnectionDataSource = "db.windows.net" + TargetSqlConnectionPassword = "password" + TargetSqlConnectionUserName = "username" + SourceSqlConnectionAuthentication = "SqlAuthentication" + SourceSqlConnectionDataSource = "sampledomain.microsoft.com" + SourceSqlConnectionUserName = "user" + SourceSqlConnectionPassword = "password" + SourceDatabaseName = "AdventureWorks" + } $cutDatabaseMigrationNameMi = "MiUnitTestCut" + $randomstring - $CutDatabaseMigrationTestVariablesMi = @{ ResourceGroupName = "migrationTesting" ManagedInstanceName = "migrationtestmi" @@ -102,14 +113,13 @@ function setupEnv() { TargetLocationAccountKey = "accountKey" FileSharePath = "\\sampledomain.onmicrosoft.com\SharedBackup\tsuman" FileShareUsername = "domainUserName" - FileSharePassword = "domainPassword" + FileSharePassword = "password" SourceSqlConnectionAuthentication = "SqlAuthentication" SourceSqlConnectionDataSource = "sampledomain.onmicrosoft.com" SourceSqlConnectionUserName = "domainUserName" - SourceSqlConnectionPassword = "domainPassword" + SourceSqlConnectionPassword = "password" SourceDatabaseName = "AdventureWorks" } - $cutDatabaseMigrationNameVm = "VmUnitTestCut" + $randomstring $CutDatabaseMigrationTestVariablesVm = @{ ResourceGroupName = "tsum38RG" @@ -122,16 +132,14 @@ function setupEnv() { TargetLocationAccountKey = "accountKey" FileSharePath = "\\sampledomain.onmicrosoft.com\SharedBackup\tsuman" FileShareUsername = "domainUserName" - FileSharePassword = "domainPassword" + FileSharePassword = "password" SourceSqlConnectionAuthentication = "SqlAuthentication" SourceSqlConnectionDataSource = "sampledomain.onmicrosoft.com" SourceSqlConnectionUserName = "domainUserName" - SourceSqlConnectionPassword = "domainPassword" + SourceSqlConnectionPassword = "password" SourceDatabaseName = "AdventureWorks" } - $stopDatabaseMigrationNameMi = "MiUnitTestStop" + $randomstring - $StopDatabaseMigrationTestVariablesMi = @{ ResourceGroupName = "migrationTesting" ManagedInstanceName = "migrationtestmi" @@ -143,14 +151,13 @@ function setupEnv() { TargetLocationAccountKey = "accountKey" FileSharePath = "\\sampledomain.onmicrosoft.com\SharedBackup\tsuman" FileShareUsername = "domainUserName" - FileSharePassword = "domainPassword" + FileSharePassword = "password" SourceSqlConnectionAuthentication = "SqlAuthentication" SourceSqlConnectionDataSource = "sampledomain.onmicrosoft.com" SourceSqlConnectionUserName = "domainUserName" - SourceSqlConnectionPassword = "domainPassword" + SourceSqlConnectionPassword = "password" SourceDatabaseName = "AdventureWorks" } - $stopDatabaseMigrationNameVm = "VmUnitTestStop" + $randomstring $StopDatabaseMigrationTestVariablesVm = @{ ResourceGroupName = "tsum38RG" @@ -163,27 +170,66 @@ function setupEnv() { TargetLocationAccountKey = "accountKey" FileSharePath = "\\sampledomain.onmicrosoft.com\SharedBackup\tsuman" FileShareUsername = "domainUserName" - FileSharePassword = "domainPassword" + FileSharePassword = "password" SourceSqlConnectionAuthentication = "SqlAuthentication" SourceSqlConnectionDataSource = "sampledomain.onmicrosoft.com" SourceSqlConnectionUserName = "domainUserName" - SourceSqlConnectionPassword = "domainPassword" + SourceSqlConnectionPassword = "password" SourceDatabaseName = "AdventureWorks" } + + $StopDatabaseMigrationTestVariablesDb = @{ + ResourceGroupName = "tsum38RG" + SqlDbInstanceName = "dmstestsqldb" + MigrationService = "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/dms20211030" + TargetSqlConnectionAuthentication = "SqlAuthentication" + TargetSqlConnectionDataSource = "db.windows.net" + TargetSqlConnectionPassword = "password" + TargetSqlConnectionUserName = "username" + SourceSqlConnectionAuthentication = "SqlAuthentication" + SourceSqlConnectionDataSource = "sampledomain.microsoft.com" + SourceSqlConnectionUserName = "user" + SourceSqlConnectionPassword = "password" + SourceDatabaseName = "AdventureWorks" + TargetDbName = "at_sqldbtrgt2" + Scope = "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb" + + } + + $DeleteDatabaseMigrationTestVariablesDb = @{ + ResourceGroupName = "tsum38RG" + SqlDbInstanceName = "dmstestsqldb" + MigrationService = "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.DataMigration/SqlMigrationServices/dms20211030" + TargetSqlConnectionAuthentication = "SqlAuthentication" + TargetSqlConnectionDataSource = "db.windows.net" + TargetSqlConnectionPassword = "password" + TargetSqlConnectionUserName = "username" + SourceSqlConnectionAuthentication = "SqlAuthentication" + SourceSqlConnectionDataSource = "sampledomain.microsoft.com" + SourceSqlConnectionUserName = "user" + SourceSqlConnectionPassword = "password" + SourceDatabaseName = "AdventureWorks" + TargetDbName = "at_sqldbtrgt1" + Scope = "/subscriptions/f133ff51-53dc-4486-a487-47049d50ab9e/resourceGroups/tsum38RG/providers/Microsoft.Sql/servers/dmstestsqldb" + } $env.add("TestSqlMigrationService", $SqlMigrationServiceTestVariables) | Out-Null $env.add("TestNewSqlMigrationService",$NewSqlMigrationServiceTestVariables) | Out-Null $env.add("TestAuthKey",$AuthKeyTestVariables) | Out-Null $env.add("TestDatabaseMigrationMi", $DatabaseMigrationTestVariablesMi) | Out-Null $env.add("TestDatabaseMigrationVm", $DatabaseMigrationTestVariablesVm) | Out-Null + $env.add("TestDatabaseMigrationDb", $DatabaseMigrationTestVariablesDb) | Out-Null $env.add("TestNewDatabaseMigrationMi", $NewDatabaseMigrationTestVariablesMi) | Out-Null $env.add("TestNewDatabaseMigrationVm", $NewDatabaseMigrationTestVariablesVm) | Out-Null + $env.add("TestNewDatabaseMigrationDb", $NewDatabaseMigrationTestVariablesDb) | Out-Null $env.add("RemoveNode",$RemoveNode) | Out-Null $env.add("TestStopDatabaseMigrationMi", $StopDatabaseMigrationTestVariablesMi) | Out-Null $env.add("TestStopDatabaseMigrationVm", $StopDatabaseMigrationTestVariablesVm) | Out-Null + $env.add("TestStopDatabaseMigrationDb", $StopDatabaseMigrationTestVariablesDb) | Out-Null $env.add("TestCutDatabaseMigrationMi", $CutDatabaseMigrationTestVariablesMi) | Out-Null $env.add("TestCutDatabaseMigrationVm", $CutDatabaseMigrationTestVariablesVm) | Out-Null - + $env.add("TestDeleteDatabaseMigrationDb", $DeleteDatabaseMigrationTestVariablesDb) | Out-Null + # For any resources you created for test, you should add it to $env here. $envFile = 'env.json' if ($TestMode -eq 'live') { @@ -193,5 +239,4 @@ function setupEnv() { } function cleanupEnv() { # Clean resources you create for testing -} - +} \ No newline at end of file