Skip to content

Commit e52d6e3

Browse files
authored
New Az PS module instead of AzureRm module
I updated the script to use Az PS module instead of AzureRM, Step #2 - There is a change on how Azure handles credential for Get-AzADApplication which requires a PSADPasswordCredential object, created on line #34 Step #4 - There is a portal UI change on step #4 to create SP secret, updated the steps Step #5 - updated with Get-AzSubscription which show both SubId and TenantId to use on step #6
1 parent 5c00ea1 commit e52d6e3

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

docs/dns-azuredns.md

+15-21
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,30 @@ Follow the instructions here: https://docs.microsoft.com/en-us/powershell/azure/
1515
From 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

2123
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.
2224

2325
Pop 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-
3627
Once connected, create the Application and Service Principal
3728
Run 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

4538
Once 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

5144
It returns something like the following:
@@ -76,22 +69,23 @@ This will have created a service principal and an underlying Azure application.
7669
From 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
8881
There 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

Comments
 (0)