Tag Archives: Microsoft

Receive a User’s UPN, Email, First and Last Name via Azure Active Directory Custom Manifest

In May 2019 Microsoft has made the new and improved App Registration portal generally available. For some time this new portal has been available under the Azure Active Directory > App registration (preview) menu in the Azure Portal. The old App Registration is still available under Azure Active Directory > App registration (legacy) but most likely it will be discontinued soon.

The ID token does no longer by default contains fields such as user principal name (UPN), email, first and last name, most likely to ensure that personal data is handled with more consideration. As a result, you must manually update the app registration’s manifest to ensure that ID tokens include the UPN, email, first and last name by adding these optional claims.

  1. Go to Azure Portal > Azure Active Directory > App registrations
  2. Find your application registration (you may click on the All applications tab)
  3. Click Manifest
  4. Update the Manifest and change the optionalClaims node as shown below
"optionalClaims": {
	"idToken": [{
			"name": "family_name",
			"source": null,
			"essential": false,
			"additionalProperties": []
		}, {
			"name": "given_name",
			"source": null,
			"essential": false,
			"additionalProperties": []
		}, {
			"name": "upn",
			"source": null,
			"essential": false,
			"additionalProperties": []
		}, {
			"name": "email",
			"source": null,
			"essential": false,
			"additionalProperties": []
	"accessToken": [],
	"saml2Token": []

Install OneDrive Free Client on Gentoo without Root Permission

OneDrive Free Client is “a complete tool to interact with OneDrive on Linux”.

Install the D language compiler:

curl -fsS https://dlang.org/install.sh | bash -s dmd

Run the full source command provided by the output of the above install script.

Download OneDrive Free Client’s source:

git clone https://github.com/skilion/onedrive.git

Change to the source directory:

cd onedrive

Use the following command to edit the prefix defined in Makefile:

sed -i 's|/usr/local|/home/username|g' Makefile

Compile and install OneDrive Free Client:

make && make install

Deactivate the source command:


Add ~/bin to your PATH so that you can run binaries in ~/bin without specifying the path. Ignore this step if you have performed it for a different program.

echo "PATH=\$HOME/bin:\$PATH" >> ~/.bashrc && source ~/.bashrc

You can now run OneDrive Free Client with onedrive. To run it in the background, you can use:

screen -dmS onedrive onedrive -m

Run the following command to create a sync list, which let onedrive only syncs specific directories:

vi ~/.config/onedrive/sync_list

In sync_list (one directory per line):


Adding Email Aliases to Office 365 Groups via PowerShell

This is a “hidden” feature that can only be added via PowerShell at the moment. And web admin portal won’t reflect the changes you made via PowerShell. That means you can only view alias for Office 365 Group from the following PowerShell cmdlet.

First log into your admin account with PowerShell

Set-UnifiedGroup –Identity [email protected] –EmailAddresses @{Add="[email protected]"}

Check if it works

Get-UnifiedGroup –Identity [email protected] | FL EmailAddresses

EmailAddresses : {smtp:[email protected], SPO:[email protected]_f0712c15-1102-49c4-945a-7eda01ce10ff, smtp:[email protected], SMTP:[email protected]}

Connect to Exchange Online PowerShell

Connect to Exchange Online PowerShell – Microsoft Docs

Set-ExecutionPolicy RemoteSigned # Windows only
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
Remove-PSSession $Session # logout

Microsoft 真是完了


因為工作原因,需要一台 Windows 的機器,之前一直在 OS X 上用 Parallels Desktop 的 Windows 虛擬機,VM 是從 modern.ie 取得的,過期之後去 Microsoft 官網買了 Windows 8.1 的許可,然後一直開心地用著

後來發現 PD 的虛擬機性能已經無法滿足我了,打算將淘汰下來的 MacBook Pro 用 Boot Camp 直接裝 Windows 來用,於是就發現了 Microsoft 的驚天大秘密!

首先我去 Microsoft 官網找 Windows 鏡像下載,登入了帳號,找了幾百個小時竟然根本無法找到!後來搜了好幾個月才發現竟然要在一個 microsoftstore.com 的網站下載!下載之後準備在 Boot Camp 中燒鏡像時才發現,Boot Camp 竟然只支援 64 位元!

這時我開始回想⋯⋯不對啊,從官網下載來的加載程式根本就沒有選擇位元的選項!又經過了數月的搜索,終於發現了 Windows 的天大的秘密!

那就是如果你是在 32 位元系統上下載鏡像,那麼你只能下載 32 位元的鏡像!同理 64 位元系統上只能下載 64 位元的鏡像!1

這時我突然想起我從 modern.ie 那邊的 VM 是 32-bit 的⋯⋯

Holy motherfucking shit!


這都 2015 年了⋯⋯


  1. 根據腳註推薦,請去下載相應 torrent 的文件,然後去 MSDN 那邊驗證 SHA1,比如我需要的是「Windows 8.1 with Update (multiple editions) (x64) – DVD (English)」:
$ openssl sha1 /Users/hep/Downloads/en_windows_8.1_with_update_x64_dvd_6051480.iso 
SHA1(/Users/hep/Downloads/en_windows_8.1_with_update_x64_dvd_6051480.iso)= a8b5df0b0816280ae18017bc4b119c77b6c6eb79

最後說一句,堅決支持 OS X 用戶使用盜版 Windows!

如何完整删除 Microsoft Mesenger for Mac

一破 IM 居然是 mpkg 包,mpkg 包吧竟然没 Uninstaller,卸载方法吧竟然我在 Mesenger 开发者 PDF 里才能找到,而且还不全。这是我用 Mac OS X 这两个月来见过最傻逼的 Mac OS X 程序,另外值得一提的是。Skype for Mac 和此软件有一拼


rm /Applications/Microsoft Messenger.app
rm ~/Library/Preferences/com.microsoft.autoupdate2.plist
rm ~/Library/Preferences/com.microsoft.error_reporting.plist
rm ~/Library/Preferences/com.microsoft.Messenger.plist
rm -rf /Library/Application Support/Microsoft
rm -rf ~/Library/Preferences/Microsoft
rm -rf ~/Library/Caches/com.microsoft.Messenger
rm -rf ~/Documents/Microsoft\ User\ Data