Skip to content

Commit 94a2a59

Browse files
committed
Adding new cmdlets, fix get backup
1 parent 1b65b7b commit 94a2a59

File tree

2 files changed

+145
-1
lines changed

2 files changed

+145
-1
lines changed

Infrastructure/AzureStack.Infra.psm1

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,14 +686,92 @@ function Get-AzsBackup {
686686
[string] $Location
687687
)
688688

689-
$resourceType = "Microsoft.Backup.Admin/backupLocations/$Location/backups"
689+
$resourceType = "Microsoft.Backup.Admin/backupLocations/backups"
690690

691691
$backuplocation = Get-AzsInfrastructureResource -Location $Location -resourceType $resourceType
692692
$backuplocation.Properties
693693
}
694694

695695
Export-ModuleMember -Function Get-AzsBackup
696696

697+
<#
698+
.SYNOPSIS
699+
Start Infrastructure Backup
700+
#>
701+
function Start-AzsBackup {
702+
[CmdletBinding(SupportsShouldProcess = $true)]
703+
Param(
704+
[Parameter(Mandatory = $false)]
705+
[string] $Location
706+
)
707+
708+
$resourceType = "Microsoft.Backup.Admin/backupLocations"
709+
Invoke-AzsInfrastructureAction -Name $Location -Action "createbackup" -Location $Location -ResourceType $resourceType
710+
}
711+
712+
Export-ModuleMember -Function Start-AzsBackup
713+
714+
<#
715+
.SYNOPSIS
716+
Restore Infrastructure Backup
717+
#>
718+
function Restore-AzsBackup {
719+
[CmdletBinding(SupportsShouldProcess = $true)]
720+
Param(
721+
[Parameter(Mandatory = $true)]
722+
[string] $Location,
723+
724+
[Parameter(Mandatory = $true)]
725+
[string] $Name
726+
727+
)
728+
729+
$resourceType = "Microsoft.Backup.Admin/backupLocations/backups"
730+
Invoke-AzsInfrastructureAction -Name $Name -Action "restore" -Location $Location -ResourceType $resourceType
731+
}
732+
733+
Export-ModuleMember -Function Restore-AzsBackup
734+
735+
<#
736+
.SYNOPSIS
737+
List Resource Provider Healths
738+
#>
739+
740+
function Get-AzsResourceProviderHealths {
741+
Param(
742+
[Parameter(Mandatory = $true)]
743+
[string] $Location
744+
745+
)
746+
747+
$resourceType = "Microsoft.InfrastructureInsights.Admin/regionHealths/serviceHealths"
748+
749+
$rolehealth = Get-AzsInfrastructureResource -Location $Location -resourceType $resourceType
750+
$rolehealth.Properties
751+
}
752+
753+
Export-ModuleMember -Function Get-AzsResourceProviderHealths
754+
755+
<#
756+
.SYNOPSIS
757+
List Infrastructure Role Healths
758+
#>
759+
760+
function Get-AzsInfrastructureRoleHealths {
761+
Param(
762+
[Parameter(Mandatory = $true)]
763+
[string] $Location
764+
765+
)
766+
767+
$resourceType = "Microsoft.InfrastructureInsights.Admin/regionHealths/serviceHealths/472aaaa6-3f63-43fa-a489-4fd9094e235f/resourceHealths"
768+
769+
$rolehealth = Get-AzsInfrastructureResource -Location $Location -resourceType $resourceType
770+
$rolehealth.Properties
771+
}
772+
773+
Export-ModuleMember -Function Get-AzsInfrastructureRoleHealths
774+
697775
function Get-AzsHomeLocation {
698776
param(
699777
[Parameter(Mandatory = $false)]

Infrastructure/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,72 @@ Get-AzsLocationCapacity
317317
The command does the following:
318318
- Retrieves Region Capacity information
319319

320+
### Show Resource Provider Healths
321+
322+
Does show resource provider healths
323+
324+
```powershell
325+
Get-AzsResourceProviderHealths
326+
```
327+
328+
The command does the following:
329+
- List Resource Provider and their Healths status
330+
331+
### Show Infrastrcuture Role Healths
332+
333+
Does show infrastructure role healths
334+
335+
```powershell
336+
Get-AzsInfrastructureRoleHealths
337+
```
338+
339+
The command does the following:
340+
- List Infrastructure Roles and their Healths status
341+
342+
### Show Backup Location
343+
344+
Does show Backup location
345+
346+
```powershell
347+
Get-AzsBackupLocation
348+
```
349+
350+
The command does the following:
351+
- List information about the backup location like share path
352+
353+
### Show Backup
354+
355+
Does show backups
356+
357+
```powershell
358+
Get-AzsBackup
359+
```
360+
361+
The command does the following:
362+
- List backups
363+
364+
### Start Backup
365+
366+
Does start a backup job
367+
368+
```powershell
369+
Start-AzsBackup
370+
```
371+
372+
The command does the following:
373+
- starts a backup job and does store it at configured share path
374+
375+
### Restore Backup
376+
377+
Does restore a backup job
378+
379+
```powershell
380+
Restore-AzsBackup -name
381+
```
382+
383+
The command does the following:
384+
- Restore a specified Backup job
385+
320386
## Scenario Command Usage
321387

322388
Demonstrates using multiple commands together for an end to end scenario.

0 commit comments

Comments
 (0)