Friday, April 19, 2024

Intune - Linux Password & Custom compliance policies

Microsoft has recently released Linux support in Intune with device enrollment and compliance policies.

To know more about enrollment check here - https://sccmentor.com/2022/10/19/first-steps-into-linux-management-via-microsoft-intune/

To understand the commands that are used to install Intune portal check here - https://joymalya.com/linux-management-with-microsoft-intune/

In this blog, I will cover how to create password and custom compliance policies and what needs to be done in client end to mark the device as complaint.

Password complexity:

When password complexity requirements are enforced, devices with weak passwords are marked as non-compliant in Intune. To resolve this issue, you need to change your device password so that it meets organization’s requirements for length and quality.

  • Basically, Intune checks pam_pwquality configuration for enforcement w.r.t Password policy in the client machine.

  • Install the following by running the command in the client terminal: sudo apt install libpam-pwquality

Next, check that pam_pwquality line in /etc/pam.d/common-password. It should be edited like below to match the password compliance policy as set in Intune.

# check that the pam_pwquality line in /etc/pam.d/common-password contains at least the required settings: password requisite pam_pwquality.so retry=3 dcredit=-1 ocredit=-1 ucredit=-1 lcredit=-1 minlen=8


Example common-password file:


If the /etc/pam.d/common-password file is not edited to match the Intune policy requirement then the machine will report non-compliant.

Custom Compliance

With custom compliance, we can use shell scripts to evaluate a Linux device.

Discovery scripts for Linux must be POSIX-compliant shell scripts, such as Bash. However, the scripts can call more complex interpreters from inside the script, like Python. To successfully use other interpreters, they must be correctly installed and configured on the devices in advance of receiving the discovery script.

About POSIX-compliant syntax: Because the custom compliance script interpreter for Linux supports only a POSIX-compliant shell, it’s important to use POSIX-syntax.

To know more, check here - Create a discovery script for custom compliance policy in Microsoft Intune | Microsoft Learn

Below is an example where we have created a shell script to check for a running process or not and if so, it outputs in JSON format. Intune checks the output with the JSON file and marks the device as complaint. If not it will mark as non-complaint.


For Select your discovery script in custom compliance in Intune , select Set reusable settings, and then specify a script that’s been previously added to the Microsoft Endpoint Manager admin center. This script must have been uploaded before you begin to create the policy.To add the script to MEM Admin center follow this article - Create a discovery script for custom compliance policy in Microsoft Intune | Microsoft Learn

Sample Script to check for running process:

#!/bin/sh
checkProcess() {
Process="processname"
if pgrep -x "$Process" >/dev/null
then
   Process="running"
   printf '{"Process": "%s"}\n' "$Process"
else
   Process="notrunning"
   printf '{"Process": "%s"}\n' "$Process"
fi
checkProcess
In the above script I have used printf to output the result in JSON format.

For Select your rules file, select the folder icon and then locate and add the JSON file for Linux that you want to use with this policy.

The JSON you enter is validated and any problems are displayed. Sample JSON to match the script output.If not what to display in Intune portal application as non-complaint.

{
	"Rules": [{
		"SettingName": "Process",
		"Operator": "IsEquals",
		"DataType": "String",
		"Operand": "running",
		"MoreInfoUrl": "https://abc.com/",
		"RemediationStrings": [{
			"Language": "en_US",
			"Title": "Process is missing",
			"Description": "Process is not running."
		}]
	}]
}

Thursday, April 18, 2024

W365: Last connected state shows incorrect date

In the windows app, if you try to access a cloud pc, the last connected info displays wrong information. Below screen shows last connected as 1 day ago. whereas, in fact the cloud pc was accessed and closed few minutes before to accessing as a new session.


Also in the browser session, the information is displayed 19hrs ago. This in-fact should show as few minutes before as even in the browser, the cloud pc was accessed and closed some minutes ago.

I believe it's taking quite sometime to get updated in the backend which shouldn't be the case and should get updated quicky to avoid confusion.

This seems to be a bug  in windows app which I have raised as a feedback. Kindly upvote to get Microsoft visibility on this.

https://feedbackportal.microsoft.com/feedback/idea/5ff778b4-1f3d-ef11-a296-000d3a044d12

Note: The browser session seems to fetch the last connected state some what quicker than the windows app once the cloud pc is disconnected. The windows app still displays wrong info.

Update (10/07/2024):

Had raised a support ticket and we had this tested out.It seems the windows app displays the last connected time in UST but the browser displays in local time. I have cross checked and it’s correct that the Windows app display last connected in UST time.

Have asked Microsoft support that this needs to be shared in Microsoft article that the windows app will display last connected state in UST format or else add the UST at end of the time stamp in windows app, so that user will be aware of this. 

This will avoid confusion and the user will understand if UST is added at end of time in the last connected in windows app.

Tuesday, April 2, 2024

W365 - cloud pc disconnect Error Code 0x3

 


As per Microsoft, Error code: 0x3 can occur when the processor is over-utilized and session can get disconnected abruptly.

Solution is to Restart Cloud PC to resolve Error Code 0x3

You can restart the cloud pc by going to windows365.microsoft.com  and  select the three dot icon next to the Cloud PC and click Restart. After restart, you should be able to access the cloud pc.