azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Lacking documentation to submit MongoDb Api migration task

Open manalotoj opened this issue 7 years ago • 4 comments

When attempting to create a dms task for mongodb, az dms project task create command returns the following error:

(InvalidRequest) The task type "Migrate.SqlServer.SqlDb" is not allowed for source platform "MongoDb" and target platform "MongoDb"

but there appears to be no way to set the --task-type. Attempting to use the --task-type argument (even with a valid value of Migrate.MongoDb) results in an unrecognized argument error.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

manalotoj avatar Jul 30 '19 01:07 manalotoj

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @rgreenMSFT

ghost avatar Oct 20 '19 07:10 ghost

Do you have the "dms-preview" extension installed? The latest 0.9.0. More info on extensions can be found here: https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-list?view=azure-cli-latest If you do have the extension installed, what version is it? I just checked creating a new mongo to mongo project works when using the latest extension.

vchske avatar Nov 13 '19 00:11 vchske

I'm experiencing the same here as manalotoj. Can't find examples thorough enough to work it out, or Mongodb ones to follow. As for the extensions link above. I mean, where do you even start?!

AndyBrownlie avatar May 19 '20 14:05 AndyBrownlie

Our sincere apologies for late response

Here are the instructions:

#Note:you can copy and paste along with comments in cloud shell

#Full script is available here also: #https://github.com/skarri-microsoft/SampleData/blob/master/az-dms-mongo-Instructions.txt #A bash script for Cosmos DB Mongo migration using DMS service-name #Please login to https://shell.azure.com/ in browser and select the subscription #to run the following commands

#please note that DMS extension is in preview and required to run these commands

#Run the following command to install DMS Mongo Preview extension az extension add --name dms-preview

#Pre requisites: Resource group, vent with default subnet mask, subid and region #Commands for the above is not covered here. rg="your-dms-mongo-rg" vnet="your-dms-mongo-vnet" region="westus" subid="your-subid" subnet="/subscriptions/${subid}/resourceGroups/${rg}/providers/Microsoft.Network/virtualNetworks/${vnet}/subnets/default"

#sku for DMS service. For full list please run this command: az dms list-skus #note all skus are not supported skuname="Premium_4vCores"

#dms service name and project name dmsservicename="your-dms-test-service" dmsproject="your-dms-mongodb"

#Creates a DMS service if it doesn't exit az dms create -l $region -n $dmsservicename -g $rg --sku-name $skuname --subnet $subnet

#Mongo DMS platform variable platform="mongodb"

#For mongo DMS it requires 3 inputs database options, source info and target info

#For samples please refer to this location: #https://github.com/skarri-microsoft/SampleData/tree/master/az-dms-mongo-sample-inputs

#Note: These files can be used as is after updating with your credentials

#For more info: az dms project task create -h

#Please note that in database-options.json the database name(s) and collection name(s) refers to #the native mongo source. #Please make sure to remove appName from the Cosmos DB Mongo connection string as it is not supported in az interface

#please upload the above sample files to the cloud shell file share #(click icon located right next to gear icon top left corner) filesDir="/home/yours"

#Below names are based on the above sample files, please update it if your file names are different dbOptionsFileName="database-options.json" nativeMongoSourceConnectionFileName="native-mongo-source-connection-info.json" cosmosDbDestinationConnectionFileName="cosmos-db-destination-connection-info.json"

#Taskid is just for convenience if you want to try multiple times. taskId="127"

#Task names: one for validation and other for actual run dmsprojectvalidationtaskValidation="offlineMigrationtaskV${taskId}" dmsprojectvalidationtaskRun="offlineMigrationtaskR${taskId}"

#Create a DMS mongo project az dms project create -l $region -g $rg --service-name $dmsservicename --source-platform $platform --target-platform $platform -n $dmsproject

#Create a DMS mongo project validation task az dms project task create -g $rg --service-name $dmsservicename --project-name $dmsproject -n $dmsprojectvalidationtaskValidation --database-options "${filesDir}/${dbOptionsFileName}" --source-connection-json "${filesDir}/${nativeMongoSourceConnectionFileName}" --target-connection-json "${filesDir}/${cosmosDbDestinationConnectionFileName}" --task-type OfflineMigration --validate-only

#Shows the output of DMS mongo project validation task az dms project task show -g $rg --service-name $dmsservicename --project-name $dmsproject -n $dmsprojectvalidationtaskValidation --expand output

#Create a DMS mongo project task to run the migration az dms project task create -g $rg --service-name $dmsservicename --project-name $dmsproject -n $dmsprojectvalidationtaskRun --database-options "${filesDir}/${dbOptionsFileName}" --source-connection-json "${filesDir}/${nativeMongoSourceConnectionFileName}" --target-connection-json "${filesDir}/${cosmosDbDestinationConnectionFileName}" --task-type OfflineMigration --validated-task-name $dmsprojectvalidationtaskValidation

#Shows the output of DMS mongo project migration task output az dms project task show -g $rg --service-name $dmsservicename --project-name $dmsproject -n $dmsprojectvalidationtaskRun --expand output

Hope this helps!

skarri-microsoft avatar Jul 31 '20 03:07 skarri-microsoft