This is a basic PowerShell script to demonstrate some core Azure concepts. It showcases how to retrieve a resource, retrieve its properties, and display its metadata.
We'll use `Get-AzResource` to get a specific Azure resource – a Virtual Machine.
```powershell
# This is a placeholder. Replace with your actual code.
$resource = Get-AzVM -Name "myResource" -ResourceGroupName "myResourceGroup"
Write-Host $resource.Name
```
The resource object is populated with the virtual machine's information. The 'Name' property showcases the resource ID.
Azure Resource Graph lets you easily query your Azure resources using queries.
Let's use Azure Resource Graph Explorer to get the total number of VMs in our Resource Group.
We'll use the query: `resourceGroup.count()`
This demonstrates retrieving a specific VM using Get-AzVM.
We can get the VM's name as well.
Let's use this code to retrieve a specific VM.