# ****************************************************** # * # * Name: move-data-2-cloud-with-azcopy.ps1 # * # * Design Phase: # * Author: John Miner # * Date: 11-11-2016 # * Purpose: Use AzCopy.exe to move data files # * from on premise to the cloud. # * # ****************************************************** # # Azure Subscriptions # # Prompts you for azure credentials Login-AzureRmAccount # Clear the screen Clear-Host # List my subscriptions Get-AzureRmSubscription # Pick my Developer one $SubscriptionId = '7c41519a-7595-4443-805d-deff7fb2a8e8' Set-AzureRmContext -SubscriptionId $SubscriptionId # # Create a resource group # # New resource group New-AzureRmResourceGroup -Name "rg4backups" -Location "East US 2" # Clear the screen Clear-Host # List resource groups Get-AzureRmResourceGroup -Name "rg4backups" # Delete resource group # Remove-AzureRmResourceGroup -Name "rg4backups -Force # # Create a storage account (cool) # # Create new storage account (cool storage) New-AzureRmStorageAccount –StorageAccountName "sa4coolback" ` -ResourceGroupName "rg4backups" -Location "East US 2" ` -Type "Standard_GRS" -Kind "BlobStorage" -AccessTier "Cool" # Clear the screen Clear-Host # Show the account Get-AzureRmStorageAccount -ResourceGroupName "rg4backups" -Name 'sa4coolback' # Delete storage account #Remove-AzureRmStorageAccount -ResourceGroupName "rg4backups" -Name 'sa4coolback' # # Create a storage account (hot) # # Create new storage account (hot storage) New-AzureRmStorageAccount –StorageAccountName "sa4hotback" ` -ResourceGroupName "rg4backups" -Location "East US 2" ` -Type "Standard_LRS" -Kind "BlobStorage" -AccessTier "Hot" # Clear the screen Clear-Host # Show the account Get-AzureRmStorageAccount -ResourceGroupName "rg4backups" -Name 'sa4hotback' # Delete storage account #Remove-AzureRmStorageAccount -ResourceGroupName "rg4backups" -Name 'sa4hotback' # # Create a storage container (cool) # # Grab storage context $StorageContext = Get-AzureRmStorageAccount -Name 'sa4coolback' -ResourceGroupName "rg4backups" # Create new container $StorageContext | New-AzureStorageContainer -Name 'sc4coolback' -Permission Off # Clear the screen Clear-Host # Show the container $StorageContext | Get-AzureStorageContainer # Remove the container # $StorageContext | Remove-AzureStorageContainer -Name 'sc4coolback' -Force # # List all blobs in the container # # List all blobs in a container. $StorageContext | Get-AzureStorageBlob -Container 'sc4coolback' # # Create a storage container (hot) # # Grab storage context $StorageContext = Get-AzureRmStorageAccount -Name 'sa4hotback' -ResourceGroupName "rg4backups" # Create new container $StorageContext | New-AzureStorageContainer -Name 'sc4hotback' -Permission Off # Clear the screen Clear-Host # Show the container $StorageContext | Get-AzureStorageContainer # Remove the container # $StorageContext | Remove-AzureStorageContainer -Name 'sc4hotback' -Force # # List all blobs in the container # # List all blobs in a container. $StorageContext | Get-AzureStorageBlob -Container 'sc4hotback'