Skip to content

Commit 7f988ac

Browse files
PsCustomObjectPsCustomObject
authored andcommitted
Added new post and fixed typos on multiple articles
1 parent c7ff79e commit 7f988ac

5 files changed

+67
-10
lines changed

_posts/2020-09-21-Exchange-Online-Certificate-Based-Authentication.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Once done click on the **Register** button, provision will only take a couple of
5555
<img src="/assets/images/Azure_Application_Registration_Summary.png"></a>
5656
</figure>
5757

58-
**Note:** The only field really needed in the *Name* one just be sure to chose a descriptive name that is easy for you to remember.
58+
**Note:** The only field really needed in the *Name* one just be sure to choose a descriptive name that is easy for you to remember.
5959
{: .notice--danger}
6060

6161
### Exchange Online Certificate Based authentication - Grant API Permissions
@@ -115,7 +115,7 @@ Thumbprint Subject
115115

116116
Open *Certificate Manager* MMC console and under *Certificates Current User / Personal / Certificates* right-click on the certificate and select *All Tasks / Export*. Just follow the export wizard be sure to select *Do not export private key* and select **CER** as the export format.
117117

118-
In the Azure Portal select *Certificates and Secretes* from the left blade and *Upload certificate* navigating to the path where the certificate has been expoted/stored
118+
In the Azure Portal select *Certificates and Secretes* from the left blade and *Upload certificate* navigating to the path where the certificate has been exported/stored
119119

120120
<figure>
121121
<a href="https://pscustomobject.github.io//assets/images/Azure_Certificate_Upload.png">
@@ -158,7 +158,7 @@ Once configuration is complete you will see a page similar the following
158158
<img src="/assets/images/Azure_Assignment_Confirmation.png"></a>
159159
</figure>
160160

161-
where you can review applied configuration and make any required change.
161+
Where you can review applied configuration and make any required change.
162162

163163
## Exchange Online Certificate Based authentication - Testing connection
164164

_posts/2020-09-25-Azure-Automation-Variables.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ header:
1818

1919
## Azure Automation Variables as Shared Resources
2020

21-
Shared Resources in Azure Automation allow us to reuse credentials, modules, schedules, connections, certificates and **variables** which will be will be the main focus of this post.
21+
Shared Resources in Azure Automation allow us to reuse credentials, modules, schedules, connections, certificates and **variables** which will be will be the main focus of the post.
2222

2323
To better understand the importance of shared resources and *variables in Azure Automation* let's go through a practical example. I have a runbook pulling data from a web service which requires to reference an API secret as part of the process to obtain an authentication token.
2424

@@ -131,11 +131,11 @@ As you can see when creating an encrypted variable Value is *omitted* in the out
131131
  <img src="/assets/images/Add_Application.png"></a>
132132
</figure>
133133

134-
This is the expected behavior as encrypted variables are *secured* with a unique key generated for each **automation account**. It goes alone encrypted variables are more secure in nature but it has to be kept in mind that, once created, azure automation variables have been created **values cannot be seen only updated**.
134+
This is the expected behaviour as encrypted variables are *secured* with a unique key generated for each **automation account**. It goes alone encrypted variables are more secure in nature but it has to be kept in mind that, once created, azure automation variables have been created **values cannot be seen only updated**.
135135

136136
### Update and Retrieve Azure Automation variable values
137137

138-
Now that we know how to create azure automation variables let's see how to work with them and update their values. Recall I had a typo in the unencrypted variable, trailing '[' character, let's fix that from the console
138+
Now that we know how to create azure automation variables lets see how to work with them and update their values. Recall I had a typo in the unencrypted variable, trailing '[' character, let's fix that from the console
139139

140140
<figure>
141141
<a href="https://pscustomobject.github.io//assets/images/Azure_Automation_Update_Variable_Value.png">
@@ -195,7 +195,7 @@ LastModifiedTime : 26.09.2020 19:14:46 +02:00
195195
Description
196196
```
197197

198-
## Getting Variable value
198+
## Getting Variable Values
199199

200200
Up to this point we've seen how to create and update Azure Automation variables, let's explore how to get values for configured variables.
201201
*Az* module makes available a cmdlet for the purpose
@@ -216,7 +216,7 @@ Description : Fixed typo in value
216216
**Note:** Omitting the *-Name* parameter will return all configured variables
217217
{: .notice--primary}
218218

219-
As I mentioned it is not possible to retrieve values for encrypted variables as they're available within the runbook at runtime via the **Get-AutomationVariable** cmdlet. Using the *Test Encrypted Variable* as example I've created a small script that will show this behavior
219+
As I mentioned it is not possible to retrieve values for encrypted variables as they're available within the runbook at runtime via the **Get-AutomationVariable** cmdlet. Using the *Test Encrypted Variable* as example I've created a small script that will show this behaviour
220220

221221
```powershell
222222
$encryptedVariableValue = Get-AutomationVariable -Name 'Test Encrypted Variable'

_posts/2021-05-02-Write-Raspberry-Image-Command-Line.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ header:
1616

1717
I am in the process of rebuilding my *Docker/Kubernetes* portable cluster which I build using a couple of RaspberryPi 4 and as part of this I needed to *reflash* the various SD cards where operating system for each node is installed.
1818

19-
Usually [Balena Etcher](https://www.balena.io/etcher/) is my go-to tool for such endeavors but being in a rush and not easy way to download the tool on my Linux box I simply used the good old command line, here is how this is done.
19+
Usually [Balena Etcher](https://www.balena.io/etcher/) is my go-to tool for such endeavours but being in a rush and not easy way to download the tool on my Linux box I simply used the good old command line, here is how this is done.
2020

2121
First of all we need to locate the device mapped to our SD card, in my case I'm using a microSD to USB adapter, which can be done with the following command:
2222

_posts/2021-05-28-Get-Current-User-UPN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ This can easily be achieved with the following command:
4848
([ADSI]"LDAP://<SID=$([System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value)>").UserPrincipalName
4949
```
5050

51-
This command,despite not as user friendly as the other commands, will return the full UPN of the user for example **PsCustomObject@domain.com**.
51+
This command, despite not as user friendly as the other commands, will return the full UPN of the user for example **PsCustomObject@domain.com**.
5252

5353
I encourage you to explore the other available methods and properties of the *[System.Security.Principal.WindowsIdentity]* [class](https://docs.microsoft.com/en-us/dotnet/api/system.security.principal.windowsidentity?view=net-5.0) as it can be really handy when trying to get details about the current user.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: "Cannot bind argument to parameter TokenExpiryTime because it is null - Error Message"
3+
excerpt: "When opening a PowerShell session to both on-prem and Exchange online in the same window cannot bing argument to parameter TokenExpiryTime because is null error message could be displayed. Let's explore how to solve this."
4+
categories:
5+
- PowerShell
6+
- Exchange
7+
- Office 365
8+
9+
tags:
10+
- PowerShell
11+
- Office365
12+
- Exchange
13+
14+
toc: true
15+
header:
16+
teaser: "/assets/images/PowerShell_Logo.png"
17+
---
18+
19+
## Exchange Online Certificate Based authentication
20+
21+
Microsoft is, *finally*, disabling **basic authentication** (read username and password) in Exchange Online in favour of **Certificate Based authentication**.
22+
23+
Once this change is fully implemented, around mid February at least for some tenants, connecting via username and passwords to Exchange Online will not be possible anymore.
24+
25+
You can read my article on how to implement *Certificate Based authentication* for Exchange Online [here](https://pscustomobject.github.io/powershell/office365/exchange/Exchange-Online-Certificate-Based-Authentication/).
26+
27+
As a result of this change I started updating one of our automations, responsible for the whole lifecycle of our mailboxes, to ditch old credential objects in favour of the more secure Certificate Authentication.
28+
29+
This is when I encountered the *‌cannot bind argument to parameter 'token expiry time' because it is null.* error message.
30+
31+
## Multiple PowerShell Exchange Sessions
32+
33+
When operating an hybrid environment it is pretty common to open, in the same window/session, a PowerShell connection to both Exchange on-prem and Exchange online.
34+
35+
This is required as part of the configuration, usually creation of the mailbox, takes place in on-prem for example via the *New-RemoteMailbox* cmdlet while other parts of the configuration are performed directly online.
36+
37+
This morning while debugging my workflow I’ve noticed that while trying to retrieve mailbox information from the on-prem server an exception was being thrown
38+
39+
```powershell
40+
# Cmdlet I was running
41+
Get-RemoteMailbox -Identity $userUpn
42+
43+
# Part of the exception message
44+
Cannot bind argument to parameter 'token expiry time' because it is null.
45+
```
46+
47+
It took me quite a bit to figure this out as no exception during the connection phase was being thrown by either module.
48+
49+
When I was about to give up and open a ticket with Microsoft, which is usually as helpful as freezer in the North Pole, I discovered by chance that opening connection to Exchange Online **first** and **only afterwards** to the Exchange on-prem was working as intended, allowing me to interact with both the Online service and my local Exchange.
50+
51+
**Note:** I have experienced/tested this with version 2.0.4 and 2.0.5 of Exchange Online PowerShell module but other versions could be affected as well.
52+
{: .notice—warning}
53+
54+
I did not dig deep into the root cause of the issue but plan to do this tomorrow and already sent my feedback to exocmdletpreview {at} service {fullstop} microsoft {fullstop} com but I doubt I will hear anything from that channel. I plan to open a ticket anyhow to at least have an official statement on this.
55+
56+
As soon as I have any news I will update the post until then I hope you can find the information useful.
57+

0 commit comments

Comments
 (0)