@@ -15,37 +15,30 @@ Follow the instructions here: https://docs.microsoft.com/en-us/powershell/azure/
1515From PowerShell:
1616
1717``` 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
1921```
2022
2123This 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.
2224
2325Pop your password and MFA requirements in as required when prompted.
2426
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-
3627Once connected, create the Application and Service Principal
3728Run the following script:
3829
3930``` powershell
4031$azurePassword = ConvertTo-SecureString "your secure password" -AsPlainText -Force
4132
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
4336```
4437
4538Once this has successfully run, you need to retrieve the ApplicationID:
4639
4740``` powershell
48- Get-AzureRmADApplication | Select-Object displayname, objectid, applicationid
41+ Get-AzADApplication | Select-Object displayname, objectid, applicationid
4942```
5043
5144It returns something like the following:
@@ -76,22 +69,23 @@ This will have created a service principal and an underlying Azure application.
7669From the Azure portal, click Azure Active Directory:
7770
7871- Click App Registrations
79- - Click Show all Applications
8072- Click LetsEncrypt
81- - Click Settings
82- - Click Keys
73+ - Click Certificates & secrets
74+ - Click Client secrets
75+ - Click New client secret
8376- Type a key description, choose when it will expire (or never – your choice) and click save.
8477
8578* IMPORTANT: The secret is only shown at this point. Copy it as once it’s hidden there is NO way to retrieve it*
8679
87- ## 5 – Retrieve Tenant ID
80+ ## 5 – Retrieve Tenant ID and Subscription ID
8881There are any number of ways to get the tenant ID, but since we’re already in PowerShell:
8982
9083``` powershell
91- Get-AzureRmTenant
84+ Get-AzSubscription
9285
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
9589```
9690
9791## 6 – Configure Credentials in Certify SSL Manager
0 commit comments