Azure PowerShell Cmdlets
Core Azure Resources
Get-AzResource
View Details
Retrieves information about Azure resources.
Parameters:
-Name: The name of the resource.-ResourceType: The type of the resource.-ResourceGroupName: The name of the resource group.
Get-AzResource -ResourceGroupName "MyResourceGroup" -ResourceType "Microsoft.Storage/storageAccounts" -Name "mystorageaccount"
New-AzResourceGroup
View Details
Creates a resource group.
Parameters:
-Name: The name of the resource group.-Location: The Azure region for the resource group.
New-AzResourceGroup -Name "MyNewResourceGroup" -Location "East US"
Remove-AzResource
View Details
Deletes an Azure resource.
Parameters:
-Name: The name of the resource to delete.-ResourceType: The type of the resource.-ResourceGroupName: The name of the resource group.-Force: Suppresses confirmation prompts.
Remove-AzResource -Name "myresource" -ResourceType "Microsoft.Compute/virtualMachines" -ResourceGroupName "MyVMResourceGroup" -Force
Virtual Machines
New-AzVM
View Details
Creates a new virtual machine.
Parameters:
-Name: The name of the virtual machine.-ResourceGroupName: The resource group for the VM.-Location: The Azure region for the VM.-ImageName: The OS image to use.-Credential: The administrator credentials.
New-AzVM -Name "MyVM" -ResourceGroupName "MyVMResourceGroup" -Location "West US" -ImageName "Win2019Datacenter"
Set-AzVM
View Details
Modifies an existing virtual machine.
Parameters:
-Name: The name of the VM.-ResourceGroupName: The resource group of the VM.-VMSize: The new size for the VM.
Set-AzVM -Name "MyVM" -ResourceGroupName "MyVMResourceGroup" -VMSize "Standard_DS2_v2"