@@ -15,37 +15,30 @@ Follow the instructions here: https://docs.microsoft.com/en-us/powershell/azure/
15
15
From PowerShell:
16
16
17
17
``` powershell
18
- PS C:\Users\Tony> Connect-AzureRmAccount
18
+ # Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
19
+ # Import-Module Az.Accounts
20
+ PS C:\Users\Tony> Connect-AzAccount
19
21
```
20
22
21
23
This will launch a web dialog to log into your Azure tenant. Ensure you connect with an account with the relevant administrative credentials in the portal.
22
24
23
25
Pop your password and MFA requirements in as required when prompted.
24
26
25
- Note: I found that this wouldn’t authenticate via the ageing proxy server on one site, with the rather esoteric error as below:
26
-
27
- ```
28
- Connect-AzureRmAccount : An error occurred while sending the request.
29
- At line:1 char:1
30
- + Connect-AzureRmAccount
31
- + ~~~~~~~~~~~~~~~~~~~~~~
32
- + CategoryInfo : CloseError: (:) [Connect-AzureRmAccount], HttpRequestException
33
- + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
34
- ```
35
-
36
27
Once connected, create the Application and Service Principal
37
28
Run the following script:
38
29
39
30
``` powershell
40
31
$azurePassword = ConvertTo-SecureString "your secure password" -AsPlainText -Force
41
32
42
- New-AzureRmADServicePrincipal -DisplayName LetsEncrypt -Password $azurePassword
33
+ # Import-Module Az.Resources
34
+ $credentials = New-Object Microsoft.Azure.Commands.ActiveDirectory.PSADPasswordCredential -Property @{ StartDate=Get-Date; EndDate=Get-Date -Year 2024; Password=$azurePassword}
35
+ $MyServicePrincipal = New-AzADServicePrincipal -DisplayName "LetsEncrypt" -PasswordCredential $credentials
43
36
```
44
37
45
38
Once this has successfully run, you need to retrieve the ApplicationID:
46
39
47
40
``` powershell
48
- Get-AzureRmADApplication | Select-Object displayname, objectid, applicationid
41
+ Get-AzADApplication | Select-Object displayname, objectid, applicationid
49
42
```
50
43
51
44
It returns something like the following:
@@ -76,22 +69,23 @@ This will have created a service principal and an underlying Azure application.
76
69
From the Azure portal, click Azure Active Directory:
77
70
78
71
- Click App Registrations
79
- - Click Show all Applications
80
72
- Click LetsEncrypt
81
- - Click Settings
82
- - Click Keys
73
+ - Click Certificates & secrets
74
+ - Click Client secrets
75
+ - Click New client secret
83
76
- Type a key description, choose when it will expire (or never – your choice) and click save.
84
77
85
78
* IMPORTANT: The secret is only shown at this point. Copy it as once it’s hidden there is NO way to retrieve it*
86
79
87
- ## 5 – Retrieve Tenant ID
80
+ ## 5 – Retrieve Tenant ID and Subscription ID
88
81
There are any number of ways to get the tenant ID, but since we’re already in PowerShell:
89
82
90
83
``` powershell
91
- Get-AzureRmTenant
84
+ Get-AzSubscription
92
85
93
- Id : xxxxxxxx-yyyy-zzzz-aaaa-bbbbbbbbbbbb
94
- Directory : somedomain.com
86
+ Name Id TenantId State
87
+ ---- -- -------- -----
88
+ Subscription Name xxxxxxxx-yyyy-zzzz-aaaa-bbbbbbbbbbbb zzzzzzzz-wwww-yyyy-aaaa-bbbbbbbbbbbb Enabled
95
89
```
96
90
97
91
## 6 – Configure Credentials in Certify SSL Manager
0 commit comments