azure - How to Export AzureVM config using powershell from portal -
i trying restore vm (http://blogs.technet.com/b/keithmayer/archive/2014/02/04/step-by-step-perform-cloud-restores-of-windows-azure-virtual-machines-using-powershell-part-2.aspx) requires export vm config before deleting vm. now, trying achieve through runbook. export-azurevm
saves config details in file in local machine using windows powershell machine. now, since running in azure portal there way save config file in azure powershell?
edit: working expected in azure portal, it's getting c: drive not sure.
$exportedfile = "c:\file.xml" new-item -path $exportfolder -itemtype directory $exportpath = $exportfolder + "\" + $vm.name + ".xml" $vm | export-azurevm -path $exportpath
output:
directory: c:\ mode lastwritetime length name pscomputername ---- --------- ------ ---- ---------- d---- 8/20/2015 2:15 pm exportvms localhost
you have copy exported files place can access place. of course can chose file storage services exist in internet. first approach copy exported files azure storage account.
here sample powershell code shows how copy files azure storage account. sample creates new storage account. if have azure storage account use, remove lines create new one.
# used settings $subscriptionname = "your subscription name" # get-azuresubscription $location = "west europe" # get-azurelocation $storageaccountname = "mystorageaccount123" # create storage account , set current. new-azurestorageaccount -location $location -storageaccountname $storageaccountname -type standard_lrs set-azuresubscription -subscriptionname $subscriptionname -currentstorageaccountname $storageaccountname $container = "exportedfiles" # create destination container in storage if not exist. $containerlist = get-azurestoragecontainer -name $container -erroraction ignore # ignore error if container not found. if ($containerlist.length -eq 0) { new-azurestoragecontainer -name $container -permission off } $exportedfile = "c:\file.xml" # should know have exported file. # upload powershell file set-azurestorageblobcontent -container $container -file $exportedfile -force
i took sample code own sample code on github gist , adapted question. can find whole sample here, if like.
if need tool access azure storage account, see list. there tools. use clumsyleaf cloudxplorer.
Comments
Post a Comment