Deploy Templates in Azure Stack using PowerShell

In this example, you run a script to deploy a virtual machine to Azure Stack Development Kit using a Resource Manager template. Before proceeding, ensure you have configured PowerShell

The VHD used in this example template is WindowsServer-2012-R2-Datacenter.

  1. Go to http://aka.ms/AzureStackGitHub, search for the 101-simple-windows-vm template, and save it to the following location: c:\templates\azuredeploy-101-simple-windows-vm.json.
  2. In PowerShell, run the following deployment script. Replace username and password with your username and password. On subsequent uses, increment the value for the $myNum parameter to prevent overwriting your deployment.
    PowerShellCopy
        # Set Deployment Variables
        $myNum = "001" #Modify this per deployment
        $RGName = "myRG$myNum"
        $myLocation = "local"
    
        # Create Resource Group for Template Deployment
        New-AzureRmResourceGroup -Name $RGName -Location $myLocation
    
        # Deploy Simple IaaS Template
        New-AzureRmResourceGroupDeployment `
            -Name myDeployment$myNum `
            -ResourceGroupName $RGName `
            -TemplateFile c:\templates\azuredeploy-101-simple-windows-vm.json `
            -NewStorageAccountName mystorage$myNum `
            -DnsNameForPublicIP mydns$myNum `
            -AdminUsername <username> `
            -AdminPassword ("<password>" | ConvertTo-SecureString -AsPlainText -Force) `
            -VmName myVM$myNum `
            -WindowsOSVersion 2012-R2-Datacenter
    
  3. Open the Azure Stack portal, click Browse, click Virtual machines, and look for your new virtual machine (myDeployment001).

Working with Azure Storage Tables from PowerShell

Azure Storage Tables is one of the four Microsoft Azure Storage abstractions available (Blobs, Queues and Azure Files are the other ones) at the time that this blog was written. It is basically a way to store data in a structured way on a non relational database system (meaning, not an RDBMS system).

Since up to today there are no official cmdlets to support entity/row management inside the tables from Azure PowerShell module, I decided to create this simple module to help IT Pros to leverage this service without having knowledge of .NET framework through some simple cmdlets as follows:

 

Cmdlet Description
Add-StorageTableRow Adds a row/entity to a specified table
Get-AzureStorageTableTable Gets an Azure Storage or Azure Cosmos DB table
Get-AzureStorageTableRowAll Returns all rows/entities from a storage table – no filtering
Get-AzureStorageTableRowByPartitionKey Returns one or more rows/entities based on Partition Key
Get-AzureStorageTableRowByColumnName Returns one or more rows/entities based on a specified column and its value (equal comparison operation)
Get-AzureStorageTableRowByCustomFilter Returns rows/entities from a table based on customer filtering
Update-AzureStorageTableRow Updates a specified table row/entity
Remove-AzureStorageTableRow Removes a specified table row

Continue reading