Azure Basic Commands:

1) Get-AzSubscription — To get existing azure subscription details.

PS /home/cloud> Get-AzSubscription

Name Id TenantId State


—- — ——– —–
P1-Real Hands-On Labs 4cedc5dd-e3ad-468d-bf66-32e31bdb9148 3617ef9b-98b4-40d9-ba43-e1ed6709cf0d Enabled

2) get-azvm –> To get existing virtual machine details

PS /home/cloud> get-azvm

ResourceGroupName Name Location VmSize OsType NIC ProvisioningState Zone
—————– —- ——– —— —— — —————– —-
1-345FB4F8-PLAYGROUND-SANDBOX newtestvm westus Standard_D2s_v3 Linux newtestvm498 Succeeded

3) stop-azvm -Name <vmname> –> Used to stop Azure VM

PS /home/cloud> stop-azvm -Name newtestvm

cmdlet Stop-AzVM at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
ResourceGroupName: 1-345FB4F8-PLAYGROUND-SANDBOX

Virtual machine stopping operation
This cmdlet will stop the specified virtual machine. Do you want to continue?
[Y] Yes [N] No [S] Suspend [?] Help (default is “Y”): Y

perationId : 26e1afe4-1937-49cd-93be-a2e40330b6a7
Status : Succeeded
StartTime : 6/5/2021 3:23:44 PM
EndTime : 6/5/2021 3:24:33 PM
Error :

4) start-azvm -Name <vmname> –> Used to start Azure VM

S /home/cloud> start-azvm -Name newtestvm

cmdlet Start-AzVM at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
ResourceGroupName: 1-345FB4F8-PLAYGROUND-SANDBOX

OperationId : 4d4c5058-9b3f-446f-888a-50380b21587b
Status : Succeeded
StartTime : 6/5/2021 3:27:12 PM
EndTime : 6/5/2021 3:27:31 PM

5) get-azureresources –> To list all azure resources

PS /home/cloud> get-azresource

Name : labraghav123
ResourceGroupName : 1-345fb4f8-playground-sandbox
ResourceType : Microsoft.Storage/storageAccounts
Location : westus
ResourceId : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Storage/storageAccounts/labraghav123
Tags :
Name Value
================= =================
ms-resource-usage azure-cloud-shell

Name : newtestvm_key
ResourceGroupName : 1-345fb4f8-playground-sandbox
ResourceType : Microsoft.Compute/sshPublicKeys
Location : westus
ResourceId : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Compute/sshPublicKeys/newtestvm_key
Tags :

Name : newtestvm-ip
ResourceGroupName : 1-345fb4f8-playground-sandbox
ResourceType : Microsoft.Network/publicIPAddresses
Location : westus
ResourceId : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Network/publicIPAddresses/newtestvm-ip
Tags :

Name : newtestvm-nsg
ResourceGroupName : 1-345fb4f8-playground-sandbox
ResourceType : Microsoft.Network/networkSecurityGroups
Location : westus
ResourceId : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Network/networkSecurityGroups/newtestvm-nsg
Tags :

Name : 1-345fb4f8-playground-sandbox-vnet
ResourceGroupName : 1-345fb4f8-playground-sandbox
ResourceType : Microsoft.Network/virtualNetworks
Location : westus
ResourceId : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Network/virtualNetworks/1-345fb4f8-playground-sandbox-vnet
Tags :

Name : newtestvm498
ResourceGroupName : 1-345fb4f8-playground-sandbox
ResourceType : Microsoft.Network/networkInterfaces
Location : westus
ResourceId : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Network/networkInterfaces/newtestvm498
Tags :

Name : newtestvm
ResourceGroupName : 1-345fb4f8-playground-sandbox
ResourceType : Microsoft.Compute/virtualMachines
Location : westus
ResourceId : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Compute/virtualMachines/newtestvm
Tags :

Name : newtestvm_disk1_7570567ed8dd4538aed49857dc7e7001
ResourceGroupName : 1-345FB4F8-PLAYGROUND-SANDBOX
ResourceType : Microsoft.Compute/disks
Location : westus
ResourceId : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345FB4F8-PLAYGROUND-SANDBOX/providers/Microsoft.Compute/disks/newtestvm_disk1_7570567ed8dd4538aed49857dc7e7001
Tags :

6) Get-Azvirtualnetwork –> Used to list Azure virtual network details.

PS /home/cloud> Get-Azvirtualnetwork

Name : 1-345fb4f8-playground-sandbox-vnet
ResourceGroupName : 1-345fb4f8-playground-sandbox
Location : westus
Id : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Network/virtualNetworks/1-345fb4f8-playground-sandbox-vnet
Etag : W/”f8b2ac50-4662-4370-bc05-50488008b680″
ResourceGuid : 02b62663-5a7b-4d87-9262-2b8cca70b042
ProvisioningState : Succeeded
Tags :
AddressSpace : {
“AddressPrefixes”: [
“10.0.0.0/16”
]
}
DhcpOptions : null
Subnets : [
{
“Delegations”: [],
“Name”: “default”,
“Etag”: “W/\”f8b2ac50-4662-4370-bc05-50488008b680\””,
“Id”:
“/subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Network/virtualNetworks/1-345fb4f8-playground-sandbox-vnet/subnets/default”,
“AddressPrefix”: [
“10.0.0.0/24”
],
“IpConfigurations”: [
{
“Id”:
“/subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/1-345fb4f8-playground-sandbox/providers/Microsoft.Network/networkInterfaces/newtestvm498/ipConfigurations/ipconfig1”
}
],
“ServiceAssociationLinks”: [],
“ResourceNavigationLinks”: [],
“ServiceEndpoints”: [],
“ServiceEndpointPolicies”: [],
“PrivateEndpoints”: [],
“ProvisioningState”: “Succeeded”,
“PrivateEndpointNetworkPolicies”: “Enabled”,
“PrivateLinkServiceNetworkPolicies”: “Enabled”,
“IpAllocations”: []
}
]
VirtualNetworkPeerings : []
EnableDdosProtection : false
DdosProtectionPlan : null

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s