Passcode
The payload that configures a passcode policy.
Declaration
object PasscodeProperties
| Name | Type | Description |
|---|---|---|
allowSimple | boolean | If |
changeAtNextAuth | boolean | If |
customRegex | Passcode.CustomRegex | Specifies a regular expression, and its description, used to enforce password compliance. Use the simpler passcode restrictions whenever possible, and rely on regular expression matching only when necessary. Mistakes in regular expressions can lead to frustrating user experiences, such as unsatisfiable passcode policies, or policy descriptions that don’t match the enforced policy. Available in macOS 14 and later. |
forcePIN | boolean | If |
maxFailedAttempts | integer | The number of failed passcode attempts that the system allows the user before it erases or locks the device. After six failed attempts, the device imposes a time delay before the user can enter a passcode again. The time delay increases with each failed attempt. On macOS, set After the final failed attempt, the system locks a macOS device, or securely erases all data and settings from an iOS, visionOS, or watchOS device. |
maxGracePeriod | integer | The maximum grace period, in minutes, to unlock the phone without entering a passcode. The default is |
maxInactivity | integer | The maximum number of minutes for which the device can be idle without the user unlocking it, before the system locks it. When this limit is reached, the system locks the device and the passcode is required to unlock it. The user can edit this setting, but the value can’t exceed the On macOS, the system translates this inactivity value to screen-saver settings. The maximum value for macOS is Setting this key removes the |
maxPINAgeInDays | integer | The number of days for which the passcode can remain unchanged. After this number of days, the system forces the user to change the passcode before it unlocks the device. |
minComplexChars | integer | The minimum number of complex characters that a passcode needs to contain. A complex character is a character other than a number or a letter, such as The system ignores this property for user enrollments. |
minLength | integer | The minimum overall length of the passcode. This value is independent of the value for |
minutesUntilFailedLoginReset | integer | The number of minutes before the system resets the login after the maximum number of unsuccessful login attempts is reached. This key requires setting |
pinHistory | integer | This value defines N, where the new passcode must be unique within the last N entries in the passcode history. |
requireAlphanumeric | boolean | If |
Discussion
Specify com.apple.mobiledevice.passwordpolicy as the payload type.
The presence of this payload type causes the device to present the user with a passcode entry mechanism. The payload controls the complexity of the passcode.
For user enrollments, the system allows this payload type, but ignores most of the keys. Instead, the presence of the payload forces only these settings:
allowSimple: always set tofalseforcePIN: always set totrueminLength: always set to6maxInactivity: if this key is present its value is ignored, but theneveroption is removed in the Settings UI.
Profile availability
Device channel | iOS, macOS, visionOS, watchOS |
User channel | macOS |
Allow manual install | iOS, macOS, visionOS, watchOS |
Requires supervision | NA |
Requires user-approved MDM | NA |
Allowed in user enrollment | iOS, visionOS |
Allow multiple payloads | iOS, macOS, visionOS, watchOS |
Profile example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>allowSimple</key>
<true/>
<key>forcePIN</key>
<true/>
<key>maxFailedAttempts</key>
<integer>5</integer>
<key>maxGracePeriod</key>
<integer>1</integer>
<key>maxInactivity</key>
<integer>2</integer>
<key>maxPINAgeInDays</key>
<real>30</real>
<key>minLength</key>
<integer>8</integer>
<key>pinHistory</key>
<real>2</real>
<key>requireAlphanumeric</key>
<false/>
<key>PayloadIdentifier</key>
<string>com.example.mypasscodepayload</string>
<key>PayloadType</key>
<string>com.apple.mobiledevice.passwordpolicy</string>
<key>PayloadUUID</key>
<string>2a8a75e5-d17d-44d5-b062-3cb92161af9f</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</array>
<key>PayloadDisplayName</key>
<string>Passcode</string>
<key>PayloadIdentifier</key>
<string>com.example.myprofile</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>e044f50d-ff67-4bcd-9f3f-d7b678091061</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</plist>