|
1 | | -.<# |
2 | | - .DESCRIPTION |
3 | | - This runbook activates a SQL Server license using the Managed Identity |
4 | | - The runbook accepts the following parameters: |
5 | | - |
6 | | - -LicenseID (The license resource URI) |
7 | | - |
8 | | - .NOTES |
9 | | - AUTHOR: Alexander (Sasha) Nosov |
10 | | - LASTEDIT: June 24, 2024 |
11 | | -#> |
12 | | - |
13 | | -param ( |
14 | | - [Parameter (Mandatory= $true)] |
15 | | - [string] $LicenseId |
16 | | -) |
17 | | - |
18 | | -# |
19 | | -# Suppress warnings |
20 | | -# |
21 | | -Update-AzConfig -DisplayBreakingChangeWarning $false |
22 | | - |
23 | | -# Logging in to Azure..." |
24 | | -try |
25 | | -{ |
26 | | - Connect-AzAccount -Identity |
27 | | -} |
28 | | -catch { |
29 | | - Write-Error -Message $_.Exception |
30 | | - throw $_.Exception |
31 | | -} |
32 | | - |
33 | | -$currentLicense = Get-AzResource -ResourceId $LicenseId |
34 | | -$currentLicense.properties.activationState = "Activated" |
35 | | -$currentLicense | Set-AzResource -Force |
36 | | - |
| 1 | +.<# |
| 2 | + .DESCRIPTION |
| 3 | + This runbook activates a SQL Server license using the Managed Identity |
| 4 | + The runbook accepts the following parameters: |
| 5 | +
|
| 6 | + -LicenseID (The license resource URI) |
| 7 | +
|
| 8 | + .NOTES |
| 9 | + AUTHOR: Alexander (Sasha) Nosov |
| 10 | + LASTEDIT: June 24, 2024 |
| 11 | +#> |
| 12 | + |
| 13 | +param ( |
| 14 | + [Parameter (Mandatory= $true)] |
| 15 | + [string] $LicenseId |
| 16 | +) |
| 17 | + |
| 18 | +# |
| 19 | +# Suppress warnings |
| 20 | +# |
| 21 | +Update-AzConfig -DisplayBreakingChangeWarning $false |
| 22 | + |
| 23 | +# Logging in to Azure..." |
| 24 | +try |
| 25 | +{ |
| 26 | + Connect-AzAccount -Identity |
| 27 | +} |
| 28 | +catch { |
| 29 | + Write-Error -Message $_.Exception |
| 30 | + throw $_.Exception |
| 31 | +} |
| 32 | + |
| 33 | +$currentLicense = Get-AzResource -ResourceId $LicenseId |
| 34 | +$currentLicense.properties.activationState = "Activated" |
| 35 | +$currentLicense | Set-AzResource -Force |
| 36 | + |
0 commit comments