2. Connect to Azure
Once you have the Azure PowerShell module downloaded, you must authenticate to your Azure subscription. Microsoft needs to know what storage accounts you have access to and what kind of permissions you have in storage accounts under your Azure subscription.
The Connect-AzAccount cmdlet displays a web page that allows you to provide your Microsoft account’s username and password. (If you have multiple Azure subscriptions, don’t forget the SubscriptionName parameter.)
3. Create a Storage Container
Your local file system uses directories or folders to separate files. In Azure, these groups of files are known as containers. Every file in an Azure storage account must be inside a container. You can create a container using the New-AzStorageContainer cmdlet.
To quickly create the required container, use the Get-AzStorageAccount cmdlet to pass the appropriate storage account to the New-AzStorageContainer cmdlet will quickly create the required container:
Get-AzStorageAccount -Name <storage_account> -ResourceGroupName <resource_group> |
New-AzStorageContainer -Name <container_name>
4. Upload Files to Azure Storage
Once you have a storage container to upload your files into, you can upload one or more files using the Set-AzStorageBlobContent cmdlet. This cmdlet needs to know the storage account and container to upload files to. One way to provide this information is by piping the necessary objects using the Get-AzStorageAccount and Get-AzStorageContainer cmdlets below:
Get-AzStorageAccount -Name <storage_account> -ResourceGroupName <resource_group> |
Get-AzStorageContainer -Name <container_name> |
Set-AzStorageBlobContent -File <file_path> -Blob '<file_name>'
Don’t forget to run Disconnect-AzAccount when you’re done if you’d prefer to not save your Azure credentials on the machine.
The cloud offers small businesses a way to catch up to enterprises when it comes to harnessing data. Find out how at biztechmag.com/CloudData.