From 19ad1f03c818d17ec73057acbafd812f61243ebe Mon Sep 17 00:00:00 2001 From: Merill Fernando Date: Thu, 26 May 2022 23:43:31 +1000 Subject: [PATCH 1/3] Update Add-MgApplicationPassword.md --- .../v1.0-beta/Add-MgApplicationPassword.md | 61 ++++++++++++++++--- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/src/Applications/Applications/examples/v1.0-beta/Add-MgApplicationPassword.md b/src/Applications/Applications/examples/v1.0-beta/Add-MgApplicationPassword.md index 093355d11d5..e8f9a798b91 100644 --- a/src/Applications/Applications/examples/v1.0-beta/Add-MgApplicationPassword.md +++ b/src/Applications/Applications/examples/v1.0-beta/Add-MgApplicationPassword.md @@ -1,18 +1,63 @@ -### Example 1: {{ Add title here }} +### Example 1: Add a password credential to an application with a six month expiry + ```powershell -PS C:\> {{ Add code here }} -{{ Add output here }} +Connect-MgGraph -Scopes 'Application.ReadWrite.All' + +$appObjectId = 'eaf1e531-0d58-4874-babe-b9a9f436e6c3' + +$passwordCred = @{ + displayName = 'Created in PowerShell' + endDateTime = (Get-Date).AddMonths(6) +} + +$secret = Add-MgApplicationPassword -applicationId $appObjectId -PasswordCredential $passwordCred +$secret | Format-List + +CustomKeyIdentifier : +DisplayName : Created in PowerShell +EndDateTime : 26/11/2022 12:03:31 pm +Hint : Q_e +KeyId : c82bb763-741b-4575-9d9d-df7e766f6999 +SecretText : Q_e8Q~ZDWJD.bkgajbREp-VFFUayCuEk8b1hDcr9 +StartDateTime : 26/5/2022 1:03:31 pm +AdditionalProperties : {[@odata.context, + https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.passwordCredential]} ``` -{{ Add description here }} +Add a password to an application that expires in six months from the current date. + +### Example 2: Add a password credential to an application with a start date -### Example 2: {{ Add title here }} ```powershell -PS C:\> {{ Add code here }} -{{ Add output here }} +Connect-MgGraph -Scopes 'Application.ReadWrite.All' + +$appObjectId = 'eaf1e531-0d58-4874-babe-b9a9f436e6c3' + +$startDate = (Get-Date).AddDays(1).Date +$endDate = $startDate.AddMonths(6) + +$passwordCred = @{ + displayName = 'Created in PowerShell' + startDateTime = $startDate + endDateTime = $endDate +} + +$secret = Add-MgApplicationPassword -applicationId $appObjectId -PasswordCredential $passwordCred +$secret | Format-List + +CustomKeyIdentifier : +DisplayName : Created in PowerShell +EndDateTime : 26/11/2022 1:00:00 pm +Hint : TiA +KeyId : 082bf20f-63d6-4970-bb4e-55e504f50d8b +SecretText : TiA8Q~Zs7ej1cGtlW0qnmuFi~JlxXTZew_tU1bGA +StartDateTime : 26/5/2022 2:00:00 pm +AdditionalProperties : {[@odata.context, + https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.passwordCredential]} ``` -{{ Add description here }} +Add a password to an application that becomes valid at 12:00 am the next day and is valid for six months. +Use `$secret.StartDateTime.ToLocalTime()` to convert the dates from UTC to the local timezone. From f3184139ee8b9fe5dbbe2db611bd866978ade1b4 Mon Sep 17 00:00:00 2001 From: Merill Fernando Date: Thu, 26 May 2022 23:44:12 +1000 Subject: [PATCH 2/3] Update Add-MgApplicationPassword.md --- .../v1.0/Add-MgApplicationPassword.md | 61 ++++++++++++++++--- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/src/Applications/Applications/examples/v1.0/Add-MgApplicationPassword.md b/src/Applications/Applications/examples/v1.0/Add-MgApplicationPassword.md index 093355d11d5..c5d6ccf9378 100644 --- a/src/Applications/Applications/examples/v1.0/Add-MgApplicationPassword.md +++ b/src/Applications/Applications/examples/v1.0/Add-MgApplicationPassword.md @@ -1,18 +1,63 @@ -### Example 1: {{ Add title here }} +### Example 1: Add a password credential to an application with a six month expiry + ```powershell -PS C:\> {{ Add code here }} -{{ Add output here }} +Connect-MgGraph -Scopes 'Application.ReadWrite.All' + +$appObjectId = 'eaf1e531-0d58-4874-babe-b9a9f436e6c3' + +$passwordCred = @{ + displayName = 'Created in PowerShell' + endDateTime = (Get-Date).AddMonths(6) +} + +$secret = Add-MgApplicationPassword -applicationId $appObjectId -PasswordCredential $passwordCred +$secret | Format-List + +CustomKeyIdentifier : +DisplayName : Created in PowerShell +EndDateTime : 26/11/2022 12:03:31 pm +Hint : Q_e +KeyId : c82bb763-741b-4575-9d9d-df7e766f6999 +SecretText : Q_e8Q~ZDWJD.bkgajbREp-VFFUayCuEk8b1hDcr9 +StartDateTime : 26/5/2022 1:03:31 pm +AdditionalProperties : {[@odata.context, + https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.passwordCredential]} ``` -{{ Add description here }} +Add a password to an application that expires in six months from the current date. + +### Example 2: Add a password credential to an application with a start date -### Example 2: {{ Add title here }} ```powershell -PS C:\> {{ Add code here }} -{{ Add output here }} +Connect-MgGraph -Scopes 'Application.ReadWrite.All' + +$appObjectId = 'eaf1e531-0d58-4874-babe-b9a9f436e6c3' + +$startDate = (Get-Date).AddDays(1).Date +$endDate = $startDate.AddMonths(6) + +$passwordCred = @{ + displayName = 'Created in PowerShell' + startDateTime = $startDate + endDateTime = $endDate +} + +$secret = Add-MgApplicationPassword -applicationId $appObjectId -PasswordCredential $passwordCred +$secret | Format-List + +CustomKeyIdentifier : +DisplayName : Created in PowerShell +EndDateTime : 26/11/2022 1:00:00 pm +Hint : TiA +KeyId : 082bf20f-63d6-4970-bb4e-55e504f50d8b +SecretText : TiA8Q~Zs7ej1cGtlW0qnmuFi~JlxXTZew_tU1bGA +StartDateTime : 26/5/2022 2:00:00 pm +AdditionalProperties : {[@odata.context, + https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.passwordCredential]} ``` -{{ Add description here }} +Add a password to an application that becomes valid at 12:00 am the next day and is valid for six months. +Use `$secret.StartDateTime.ToLocalTime()` to convert the returned dates from UTC to the local timezone. From f3624a344b77472275382ae91e85b0c09eb89466 Mon Sep 17 00:00:00 2001 From: Merill Fernando Date: Thu, 26 May 2022 23:45:14 +1000 Subject: [PATCH 3/3] Update Add-MgApplicationPassword.md --- .../examples/v1.0-beta/Add-MgApplicationPassword.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Applications/Applications/examples/v1.0-beta/Add-MgApplicationPassword.md b/src/Applications/Applications/examples/v1.0-beta/Add-MgApplicationPassword.md index e8f9a798b91..c5d6ccf9378 100644 --- a/src/Applications/Applications/examples/v1.0-beta/Add-MgApplicationPassword.md +++ b/src/Applications/Applications/examples/v1.0-beta/Add-MgApplicationPassword.md @@ -60,4 +60,4 @@ AdditionalProperties : {[@odata.context, Add a password to an application that becomes valid at 12:00 am the next day and is valid for six months. -Use `$secret.StartDateTime.ToLocalTime()` to convert the dates from UTC to the local timezone. +Use `$secret.StartDateTime.ToLocalTime()` to convert the returned dates from UTC to the local timezone.