azure automation
50 TopicsVideo: Mastering Azure using Cloud Shell, PowerShell and Bash!
I recorded my presentation and made it available for everyone. The presentation is a live demo and summary of my blog post “Mastering Azure with Cloud Shell“, which gives you an overview about the Cloud Shell and some of the advanced stuff you can do. In the session you learn: Overview about Cloud Shell Azure PowerShell and Bash experience Persistent Storage using Azure Files Azure Drive Third party tools Editors Visual Studio Code integration Using Git as Source Control Remote manage Azure virtual machines Integration of Cloud Shell in Microsoft Docs, Microsoft Learn and more Cloud Shell in the Azure Mobile App and more. I hope you enjoy watching it and let me know what you think in the comments.1.1KViews1like0CommentsExtracting Virtual Machine Information in Azure.
I just want to shared my modified code in azure vm information extraction. Data will be the list of VMName, IPAddress, ResourceGroup, VmSize & Tag. # User Authentication $ua = Get-StoredCredential -Target AzureAccount $credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $ua.UserName,$ua.Password # Login to your Azure Account Connect-AzAccount -Tenant '<Tenant ID>' -Credential $credential # Get All Virtual Machines & VMSize $resultVMs = Get-AzVM | Where-Object { $_.Name -and $_.ResourceGroupName -and $_.HardwareProfile.VmSize } ` | Select-Object -Property @{n="Resource"; e={ $_.ResourceGroupName }}, @{n="VMName"; e={ $_.Name }}, @{n="VmSize"; e={ $_.HardwareProfile.VmSize }} ` # Get All Virtual Machines & WorkNo Tag $resultTags = Get-AzResource -ResourceType "Microsoft.Compute/virtualMachines" ` | Where-Object { $_.Name -and $_.ResourceGroupName -and $_.Tags.WorkNo } ` | Select-Object -Property @{n="Resource"; e={ $_.ResourceGroupName }}, @{n="VMName"; e={ $_.Name }}, @{n="Tags"; e={ $_.Tags.WorkNo }} ` # Get All Virtual Machines & Ip Address $resultIPAdds = Get-AzNetworkInterface | Where-Object { $_.ResourceGroupName -and $_.VirtualMachine -and $_.IPConfigurations -and $_.IPConfigurations.PrivateIPAddress } ` | Select-Object -Property @{n="Resource"; e={ $_.ResourceGroupName }}, @{n="VMName"; e={ $_.VirtualMachine.Id.Split("/")[-1] }}, @{n="PrivateIPAddress"; e= { $_.IpConfigurations.PrivateIPAddress }} ` # Create Report Array $report = @() # Loop All VM's foreach($resultVM in $resultVMs){ # Creating Report Header $reportdetails = "" | Select VMName, IPAddress, ResourceGroup, VmSize, Tag # Save the VM Name $reportdetails.VMName = $resultVM.VMName # Save the Resource Group Name $reportdetails.ResourceGroup = $resultVM.Resource # Save the VmSize $reportdetails.VmSize = $resultVM.VmSize # Save the IP Address $temp = @(($resultIPAdds | Where-Object { $_."VMName" -match $resultVM.VMName }).PrivateIPAddress) $reportdetails.IPAddress = $temp[0] # Save the Tag $temp = @(($resultTags | Where-Object { $_."VMName" -match $resultVM.VMName }).Tags) $reportdetails.Tag = $temp[0] # Save Report $report+=$reportdetails } # Generate Report $report | Export-Excel ".\Desktop\VMList_ $(get-date -f yyyy.MM.dd.HH.mm.ss).xlsx" Write-Host "Finished..." Hope it can help others too. 😁😁😁.3.8KViews1like4Comments