User Profile
Kalaimani
Brass Contributor
Joined 5 years ago
User Widgets
Recent Discussions
Pass the user name and password to connect the azure in DevOps
Dear All, I'm a learner of DevOps and need your help to connect the Azure PowerShell in DevOps. Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force -AllowClobber $Uname=$env:Name $Uname $Pname = $env:Password | ConvertTo-SecureString -AsPlainText -Force $Pname $Credentials = New-Object System.Management.Automation.PSCredential $Uname,$Pname Connect-AzAccount -Credential $Credentials $env:Name and $env:Password trying to get from DevOps variables1.3KViews0likes0Comments- 670Views0likes0Comments
Parallel VM restore in PowerShell
Deal All, When I try to run Parallel VM restore in PowerShell, I receive the following error message.We have functions for restoring, but the Parallel one does not work, could someone please assist me with this? # Function to run the restore process for VMs in parallel using PowerShell runspaces function Restore-VMsInParallel { param ( [array]$VMsInfo ) $runspacePool = [RunspaceFactory]::CreateRunspacePool(1, [System.Management.Automation.Runspaces.Runspace]::DefaultRunspace) $runspacePool.Open() $jobs = @() foreach ($vmInfo in $VMsInfo) { $job = [PowerShell]::Create().AddScript({ param ($info) Restore-VMAndSnapshots -SubscriptionId $info.SubscriptionId -ResourceGroupName $info.ResourceGroupName -VMName $info.VMName }).AddArgument($vmInfo) $job.RunspacePool = $runspacePool $jobs += $job } $results = $jobs | ForEach-Object { $_.BeginInvoke() } $jobs | ForEach-Object { $_.EndInvoke($_) } $runspacePool.Close() $runspacePool.Dispose() } # Read VM details with snapshot information from the CSV file $csvFilePath = "C:\CSV\file.csv" $vms = Import-Csv -Path $csvFilePath # Create an array to store VM information $vmInfoArray = @() # Convert CSV data to VM information array foreach ($vm in $vms) { $vmInfo = @{ ResourceGroupName = $vm.ResourceGroupName VMName = $vm.VMName SubscriptionId = $vm.SubscriptionId } $vmInfoArray += New-Object PSObject -Property $vmInfo } # Restore all VMs in parallel Restore-VMsInParallel -VMsInfo $vmInfoArrayNeed to join the Azure diagnostics and Resource specific
Dear Team, I am looking for getting the result of both tables (Azure diagnostics and Resource specific) in a single query. we have configured with both options in the log analytics workspace server I have a query aboutAzure diagnostics. 1. To get failed backup job let Events = AzureDiagnostics | where Category == "AzureBackupReport"; Events | extend JobOperationSubType_s = columnifexists("JobOperationSubType_s", "") | where OperationName == "Job" and JobOperation_s == "Backup" and JobStatus_s == "Failed" and JobOperationSubType_s != "Log" and JobOperationSubType_s != "Recovery point_Log" | distinct JobUniqueId_g, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | project BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | join kind=leftouter ( Events | where OperationName == "BackupItem" | distinct BackupItemUniqueId_s, BackupItemFriendlyName_s | project BackupItemUniqueId_s , BackupItemFriendlyName_s ) on BackupItemUniqueId_s | project BackupItemFriendlyName_s, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | extend Vault= Resource | extend dt = todatetime(JobStartDateTime_s) | summarize count() by BackupItemFriendlyName_s, JobStatus_s,JobFailureCode_s, Vault, BackupItemUniqueId_s, NewDateTime=dt, JobStartDateTime_s 2 Backup History for Selected VM let Events = AzureDiagnostics | where TimeGenerated > ago(30d) | where Category == "AzureBackupReport"; Events | extend JobOperationSubType_s = columnifexists("JobOperationSubType_s", "") | where OperationName == "Job" and JobOperation_s == "Backup" and JobOperationSubType_s != "Log" and JobOperationSubType_s != "Recovery point_Log" | distinct JobUniqueId_g, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | project BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | join kind=leftouter ( Events | where OperationName == "BackupItem" | distinct BackupItemUniqueId_s, BackupItemFriendlyName_s | project BackupItemUniqueId_s , BackupItemFriendlyName_s ) on BackupItemUniqueId_s | project BackupItemFriendlyName_s, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | extend Vault= Resource | extend dt = todatetime(JobStartDateTime_s) | where BackupItemFriendlyName_s in ("GZ-xxxxxxx","GX-xxxxxxxxx") | summarize count() by BackupItemFriendlyName_s, JobStatus_s,JobFailureCode_s, Vault, NewDateTime=dt, JobStartDateTime_s 3 Restore History for Selected VM let Events = AzureDiagnostics | where TimeGenerated > ago(300d) | where Category == "AzureBackupReport"; Events | extend JobOperationSubType_s = columnifexists("JobOperationSubType_s", "") | where OperationName == "Job" | where JobOperation_s == "Restore" or JobOperation_s == "Recovery" | distinct JobUniqueId_g, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s , JobOperation_s | project BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s, JobOperation_s | join kind=leftouter ( Events | where OperationName == "BackupItem" | distinct BackupItemUniqueId_s, BackupItemFriendlyName_s | project BackupItemUniqueId_s , BackupItemFriendlyName_s ) on BackupItemUniqueId_s | project BackupItemFriendlyName_s, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s , JobOperation_s | extend Vault= Resource | extend dt = todatetime(JobStartDateTime_s) | where BackupItemFriendlyName_s in ("GZ-xxxxxxxxx","GX-xxxxxxxxxx") | summarize count() by BackupItemFriendlyName_s, JobStatus_s,JobFailureCode_s, Vault, NewDateTime=dt, JobStartDateTime_s ,JobOperation_s2.4KViews0likes6CommentsRe: Need to join the Azure diagnostics and Resource specific
Dear Anders Bengtsson, Yes, I have checked the Backup Explorer. But we have 2000 Recovery Services vault and 4 log analytics workspaces. So we want to get in one short using the query. Currently using above one but due to recent changes, we need a modification. Kindly help on those, please.2.3KViews0likes2CommentsRe: Azure Backup Report
CliveWatsonDear Sir, Recently we have changed theDestination table fromAzure diagnostics toResource specific, now we cannot get the resultResource specific. We need to join theAzure diagnostics andResource specific in a single report. Kindly help with this. below is one working forAzureDiagnostics, notResource specific let Events = AzureDiagnostics | where Category == "AzureBackupReport"; Events | extend JobOperationSubType_s = columnifexists("JobOperationSubType_s", "") | where OperationName == "Job" and JobOperation_s == "Backup" and JobStatus_s == "Failed" and JobOperationSubType_s != "Log" and JobOperationSubType_s != "Recovery point_Log" | distinct JobUniqueId_g, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | project BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | join kind=leftouter ( Events | where OperationName == "BackupItem" | distinct BackupItemUniqueId_s, BackupItemFriendlyName_s | project BackupItemUniqueId_s , BackupItemFriendlyName_s ) on BackupItemUniqueId_s | project BackupItemFriendlyName_s, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | extend Vault= Resource | extend dt = todatetime(JobStartDateTime_s) | summarize count() by BackupItemFriendlyName_s, JobStatus_s,JobFailureCode_s, Vault, BackupItemUniqueId_s, NewDateTime=dt, JobStartDateTime_s1.1KViews0likes0CommentsPowershell to select the last result based on the per object (Jobname =Specification)
Dear All, I'm developing HPDP daily report, able to get the result but the same job run multiple time in one day due to failure Currently, I'm looking to get only the last result in the last 24 hours $onlyLastEp =Get-ListSessions foreach ($obj in $onlyLastEp) { $obj |?{$obj.Specification } | Sort-Object EndTime -Descending | Select-Object -Property "Session Type", Specification,Status | Select-Object -First 1 | Export-Csv C:\Temp\report.csv -Append } this working but still getting the duplicate available membership : PS C:\Windows\system32> Get-ListSessions |gm TypeName: Selected.System.Management.Automation.PSCustomObject Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() Duration NoteProperty System.TimeSpan Duration=00:02:51 End Time NoteProperty System.DateTime End Time=2/20/2021 7:32:54 PM Errors NoteProperty System.Int32 Errors=0 Files NoteProperty System.Int32 Files=309 GB Written NoteProperty System.Double GB Written=1.55 Media NoteProperty System.Int32 Media=5 Mode NoteProperty System.String Mode=diff Objects NoteProperty System.Int32 Objects=5 Queuing NoteProperty System.String Queuing=0:00 Session ID NoteProperty System.String Session ID=2021/02/20-7 Session Type NoteProperty System.String Session Type=Backup Specification NoteProperty System.String Specification=MSSQL H_Backup Start Time NoteProperty System.DateTime Start Time=2/20/2021 7:30:03 PM Status NoteProperty System.String Status=Completed Warnings NoteProperty System.Int32 Warnings=0 PS C:\Windows\system32> PS C:\Windows\system32> Can someone help me with this?1KViews0likes1CommentRe: Azure Backup Report
CliveWatsonDear Sir, Really thank you for helping me with this. #1 As you have exceed a hard limit of 10,000 are you able to accept a solution that shows maybe the report in two groups (Servers A-M, N-Z) etc ? Yes, if it's possible. I have not tried it and not sure Could we show the report filtered by Country, Region or ResourceGroup or some other divider to get us below 10k? Yes, if it's possible. I have not tried it and not sure Are all 15k servers are backed up each time - is that right? Yes, all servers are backing up at a different time but within 24 hours. #2 Heartbeat not working for me.1.2KViews0likes1CommentRe: Azure Backup Report
CliveWatson Dear Sir, Yes, we have more than 15000 servers in the cloud. those all need to be generated in a single backup report. so need to get more than10000. we are using the below query to get the result let Events = AzureDiagnostics | where Category == "AzureBackupReport"; Events | extend JobOperationSubType_s = columnifexists("JobOperationSubType_s", "") | where OperationName == "Job" and JobOperation_s == "Backup" and JobOperationSubType_s != "Log" and JobOperationSubType_s != "Recovery point_Log" | distinct JobUniqueId_g, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | project BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | join kind=leftouter ( Events | where OperationName == "BackupItem" | distinct BackupItemUniqueId_s, BackupItemFriendlyName_s | project BackupItemUniqueId_s , BackupItemFriendlyName_s ) on BackupItemUniqueId_s | project BackupItemFriendlyName_s, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | extend Vault= Resource | extend dt = todatetime(JobStartDateTime_s) | summarize count() by BackupItemFriendlyName_s, JobStatus_s, Vault, BackupItemUniqueId_s, JobFailureCode_s, NewDateTime=dt, JobStartDateTime_s below warring, we are getting while running the above query. Completed. Showing partial results from the last 24 hours. 00:06.0 10,000+ records Showing the first 10,000 results. Learn more on how to narrow down the result set. ============================================================= Also, we are trying the get the computer name, hostname name, and OS version but not able to get it Please help with this. let Events = AzureDiagnostics | project Computer, HostName, OperatingSystemFullName | where Category == "AzureBackupReport"; Events | extend JobOperationSubType_s = columnifexists("JobOperationSubType_s", "") | where OperationName == "Job" and JobOperation_s == "Backup" and JobOperationSubType_s != "Log" and JobOperationSubType_s != "Recovery point_Log" | distinct JobUniqueId_g, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | project BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | join kind=leftouter ( Events | where OperationName == "BackupItem" | distinct BackupItemUniqueId_s, BackupItemFriendlyName_s | project BackupItemUniqueId_s , BackupItemFriendlyName_s ) on BackupItemUniqueId_s | project BackupItemFriendlyName_s, BackupItemUniqueId_s, JobStatus_s, Resource, JobFailureCode_s, JobStartDateTime_s | extend Vault= Resource | extend dt = todatetime(JobStartDateTime_s) | summarize count() by BackupItemFriendlyName_s, JobStatus_s, Vault, BackupItemUniqueId_s, JobFailureCode_s, NewDateTime=dt, JobStartDateTime_s, HostName, OperatingSystemFullName 'project' operator: Failed to resolve scalar expression named 'HostName' If issue persists, please open a support ticket. Request id: 43b5c644-ee20-470a-a741-dcc74036e6af the below error getting when I try to get theComputer, HostName, OperatingSystemFullName (OS version ) this is the most needed for me. Please help me with this.6.2KViews0likes4CommentsRe: Azure Backup Report
CliveWatsonHi Sir, its failed with the bellow error, 'join' operator: Failed to resolve table or column expression named 'VMComputer' If issue persists, please open a support ticket. Request id: 1ba0f22c-512e-409d-8112-4ae0afe11ef8 we are usingAzure Backup Monitoring Solution. is there any way to get the computer name6.3KViews0likes7Comments
Recent Blog Articles
No content to show