← Back to Articles         
Azure AzCopy and PowerShell Commands – AZ-104 Revision

Azure AzCopy and PowerShell Commands – AZ-104 Revision

Published on 25 Oct 2026     2 min read Azure DevOps
Azure 104
 

Azure AzCopy and PowerShell Commands with Simple Examples

Command

Simple example

Purpose

azcopy copy

azcopy copy "C:\Images\photo.jpg" "https://myaccount.blob.core.windows.net/images/photo.jpg?<SAS>"

Copies a file to Azure Blob Storage.

azcopy copy --recursive

azcopy copy "\\server1\images" "https://myaccount.blob.core.windows.net/images?<SAS>" --recursive

Copies all files and subfolders recursively.

azcopy sync

azcopy sync "C:\Images" "https://myaccount.blob.core.windows.net/images?<SAS>"

Synchronizes source and destination changes.

Get-ChildItem

Get-ChildItem -Path "C:\Images"

Lists files and folders in a directory.

Get-ChildItem -Recurse

Get-ChildItem -Path "C:\Images" -Recurse

Lists files and folders, including subfolders.

Set-AzStorageBlobContent

Set-AzStorageBlobContent -File "C:\Images\photo.jpg" -Container "images" -Blob "photo.jpg" -Context $ctx

Uploads a file to a Blob Storage container.

Get-AzStorageBlob

Get-AzStorageBlob -Container "images" -Context $ctx

Lists blobs in a container.

Get-AzStorageContainer

Get-AzStorageContainer -Context $ctx

Lists containers in a storage account.

New-AzStorageContainer

New-AzStorageContainer -Name "images" -Context $ctx

Creates a new blob container.

Remove-AzStorageBlob

Remove-AzStorageBlob -Container "images" -Blob "photo.jpg" -Context $ctx

Deletes a blob.

Get-AzStorageAccount

Get-AzStorageAccount -ResourceGroupName "rg-jntech-lab"

Retrieves storage account details in a resource group.

New-AzStorageAccount

New-AzStorageAccount -ResourceGroupName "rg-jntech-lab" -Name "jntechstore123" -Location "CentralIndia" -SkuName "Standard_LRS" -Kind "StorageV2"

Creates a storage account.

Connect-AzAccount

Connect-AzAccount

Signs in to Azure PowerShell.

Get-AzSubscription

Get-AzSubscription

Lists accessible Azure subscriptions.

Set-AzContext

Set-AzContext -SubscriptionId "your-subscription-id"

Selects the active subscription.

Get-AzResourceGroup

Get-AzResourceGroup

Lists resource groups.

Get-AzVM

Get-AzVM -ResourceGroupName "rg-jntech-lab"

Lists virtual machines in a resource group.

Start-AzVM

Start-AzVM -ResourceGroupName "rg-jntech-lab" -Name "jntech-vm1"

Starts a virtual machine.

Stop-AzVM

Stop-AzVM -ResourceGroupName "rg-jntech-lab" -Name "jntech-vm1"

Stops a virtual machine.

Restart-AzVM

Restart-AzVM -ResourceGroupName "rg-jntech-lab" -Name "jntech-vm1"

Restarts a virtual machine.

Important points for AZ-104

  • AzCopy is a command-line utility for transferring data to and from Azure Storage.

  • --recursive includes files in subdirectories.

  • azcopy sync synchronizes differences; review deletion behavior before using it.

  • Set-AzStorageBlobContent uploads files using Azure PowerShell.

  • $ctx represents an Azure Storage context containing the required storage connection and authentication information.

  • <SAS> is a placeholder for a valid Shared Access Signature; replace it with an appropriately scoped SAS token. Do not include the angle brackets.

← Back to Articles