- How to install AzureAD module without internet connection
- Download nupkg file from PowerShell Gallery
- for module that has dependences, you can download all nupkg files into same folder
- copy nupkg file to a dedicated folder
- Assuming you have NuGet available, run "Register-PSRepository -Name <pickAName4YourRepository> -SourceLocation <absolute path to nupkg file>"
- You can now "find-module -repository <repositoryName>"
- "Install-Module -Name <moduleName>"
- placeholder
- Install modules behind company proxy
- run below as admin
- [System.Net.WebRequest]::DefaultWebProxy.Credentials = Get-Credential
- [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- ODATA filter syntax
- Get-AzureADUser -Filter "proxyAddresses/any(c:c eq 'smtp:user@domain.com')"
- Get-AzureADUser -Filter "Department eq 'HP'"
- Get-AzureADDirectoryROle -filter "DisplayName eq 'application administrator'"
- Find reference on Oasis website
- placeholder
- placeholder
John Lan's Notes
Things I learn in the field of IdM
Search This Blog
Feb 28, 2024
AzureAD module for Graph Notes
Jan 31, 2024
[PowerShell] When ExpandProperty is not good enough
The ExpandProperty parameter in select-object cmdlet is useful to view full values of a compound property (e.g. when a property's value is an array or an object). However the limitation is also obvious. It accepts only one property, so we are forced to write a script block to process all results, using a different way to convert/expand properties one by one, before we can finally assembly the output.
The other way to do it is to use inline expression. See below
$targetedProperties=@(samaccountname,@{l='membership'; e={$_.memberof}}@{l='allEmailAddresses'; e={$_.proxyAddresses}})$uObj = get-aduser 'johnDoe' -properties *$expandedObj = $uObj | select $targetedProperties
Array that includes most meaningful AD attributes for admins
$meaningfulP = @(
"AccountExpirationDate"
#"accountExpires" # above converted value is readable to human - blank means never
"AccountLockoutTime"
"AccountNotDelegated"
"AllowReversiblePasswordEncryption"
#"BadLogonCount" # these are temporary values that are reset by AD periodically
#"badPasswordTime"
#"badPwdCount"
"c"
"CannotChangePassword"
"CanonicalName"
"City"
"CN"
"co"
"codePage"
"Company"
"Country"
"countryCode"
"Created"
"createTimeStamp"
"Deleted"
"Department"
#"departmentNumber"
@{l="deptNumber";e={$_.departmentNumber}}
"Description"
"DisplayName"
"DistinguishedName"
"Division"
"EmailAddress"
"EmployeeID"
"EmployeeNumber"
"employeeType"
"Enabled"
"extensionAttribute12"
"extensionAttribute14"
"extensionAttribute2"
"extensionAttribute3"
"extensionAttribute4"
"extensionAttribute5"
"extensionAttribute6"
"extensionAttribute8"
"extensionAttribute9"
"Fax"
"GivenName"
"HomeDirectory"
"HomedirRequired"
"HomeDrive"
"HomePage"
"HomePhone"
"Initials"
"instanceType"
"isDeleted"
"l"
"LastBadPasswordAttempt"
"LastKnownParent"
"LastLogonDate"
"legacyExchangeDN"
"LockedOut"
"lockoutTime"
"logonCount"
"LogonWorkstations"
"mail"
"mailNickname"
"Manager"
#"MemberOf"
@{l='membership';e={($_.Memberof)[0..20]}} #to prevent this value to become too large to fit into Excel cell limit
"MNSLogonAccount"
"MobilePhone"
"Modified"
"modifyTimeStamp"
"Name"
"ObjectCategory"
"ObjectClass"
"Office"
"OfficePhone"
"Organization"
"OtherName"
"PasswordExpired"
"PasswordLastSet"
"PasswordNeverExpires"
"PasswordNotRequired"
"physicalDeliveryOfficeName"
"POBox"
"PostalCode"
"preferredLanguage"
"ProfilePath"
"ProtectedFromAccidentalDeletion"
#"proxyAddresses"
@{l='allEmailAddr';e={$_.proxyAddresses}}
"SamAccountName"
"sAMAccountType"
"ScriptPath"
"sDRightsEffective"
#"ServicePrincipalNames"
@{l='SPN';e={$_.ServicePrincipalNames}}
"SmartcardLogonRequired"
"sn"
"st"
"State"
"StreetAddress"
"Surname"
"targetAddress"
"Title"
"TrustedForDelegation"
"TrustedToAuthForDelegation"
"UseDESKeyOnly"
"userAccountControl"
"UserPrincipalName"
"whenChanged"
"whenCreated"
)
Dec 2, 2023
Typescript with VS code notes
Header Placeholder
Normal Text place holder
- To add a different launch profile (i.e. run same source file with different settings, or specify a different start script etc.). Open launch.json file in editor, click on "Add Configuration" button. Resulting file below// Sample launch.json"version": "0.2.0","configurations": [{"type": "node","request": "launch","name": "Run Dist/index.js","program": "./dist/index.js","envFile": "${workspaceFolder}/.env","outFiles": ["${workspaceFolder}/**/*.js"]},{"type": "node","request": "launch","name": "Run testSMS.js","program": "./dist/testSMS.js","envFile": "${workspaceFolder}/.env","outFiles": ["${workspaceFolder}/**/*.js"]}]}
- Select a launch item to run
- Click "Run & Debug" button
- at top left corner, click on dropdown list besides green triangle, it should list 2 launch items listed in above sample file, one called "run index.js", the other called "run testsms.js".
- Select either one to run
- Any environment variables you specified in envFile above, you will have to define them as well in other running environments. For example, if you run the script from command line using "node.exe" then you have to "set env variables". If run in Azure app service, it should be defined under app service, configuration \ application settings section
- Bulletpoint placeholder
How to update a library
- Do NOT update the library source code in main program
- open a separate code window, make changes
- finish change and commit/sync
- "npm version patch" to update patch number. (or use other npm version parameter to update minor version or major version)
- "npm publish" to publish it to NPM repository
- back to main program,
- if package.json uses "^version#" in dependencies section, run "npm update", it should pull the latest version
- if package.json uses "version #" dependencies section, then edit the version# to be latest version, then remove library folder, and "npm install"
Subscribe to:
Posts (Atom)