Skip to content

Commit 8627cef

Browse files
committed
custom device profile
1 parent 564d70e commit 8627cef

File tree

1 file changed

+63
-27
lines changed
  • src/content/docs/cloudflare-one/connections/connect-devices/warp/configure-warp

1 file changed

+63
-27
lines changed

src/content/docs/cloudflare-one/connections/connect-devices/warp/configure-warp/device-profiles.mdx

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 2
66
---
77

8-
import { Render, TabItem, Tabs } from "~/components";
8+
import { Render, TabItem, Tabs, APIRequest } from "~/components";
99

1010
<Render file="warp/device-profiles-intro" />
1111

@@ -32,34 +32,70 @@ Your profile will appear in the **Profile settings** list. You can rearrange the
3232

3333
<TabItem label="API">
3434

35-
Send a `POST` request to the [Devices endpoint](/api/resources/zero_trust/subresources/devices/subresources/policies/subresources/custom/methods/create/):
36-
37-
```bash
38-
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/devices/policy \
39-
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
40-
--header "Content-Type: application/json" \
41-
--data '{
42-
"allow_mode_switch": false,
43-
"allow_updates": false,
44-
"allowed_to_leave": false,
45-
"auto_connect": 900,
46-
"captive_portal": 180,
47-
"description": "Cloudflare'\''s basic device settings profile, recommended in the implementation documentation. For details, refer to https://developers.cloudflare.com/learning-paths/replace-vpn/configure-device-agent/device-profiles/",
48-
"disable_auto_fallback": true,
49-
"enabled": true,
50-
"exclude_office_ips": false,
51-
"match": "identity.email == \"[email protected]\"",
52-
"name": "Cloudflare basic device profile",
53-
"precedence": 101,
54-
"service_mode_v2": {
55-
"mode": "warp"
56-
},
57-
"support_url": "https://it.company.com/help",
58-
"switch_locked": true
59-
}'
35+
Send a `POST` request to the [Devices API](/api/resources/zero_trust/subresources/devices/subresources/policies/subresources/custom/methods/create/):
36+
37+
<APIRequest
38+
path="/accounts/{account_id}/devices/policy"
39+
method="POST"
40+
json={{
41+
"allow_mode_switch": false,
42+
"allow_updates": false,
43+
"allowed_to_leave": false,
44+
"auto_connect": 600,
45+
"captive_portal": 180,
46+
"description": "Example device profile recommended in the implementation documentation. For details, refer to https://developers.cloudflare.com/learning-paths/replace-vpn/configure-device-agent/device-profiles/",
47+
"disable_auto_fallback": true,
48+
"enabled": true,
49+
"exclude_office_ips": false,
50+
"match": "identity.email in {\"[email protected]\"} or any(identity.groups.name[*] in {\"developers\" \"admin\"}) and os.name == \"windows\"",
51+
"name": "Example device profile",
52+
"precedence": 101,
53+
"service_mode_v2": {
54+
"mode": "warp"
55+
},
56+
"support_url": "https://support.example.com",
57+
"switch_locked": true
58+
}}
59+
/>
60+
61+
</TabItem>
62+
<TabItem label="Terraform (v5)">
63+
64+
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/api_token):
65+
- `Zero Trust Write`
66+
67+
2. Create a new profile using the [`cloudflare_zero_trust_device_custom_profile`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/zero_trust_device_custom_profile) resource:
68+
69+
```tf
70+
resource "cloudflare_zero_trust_device_custom_profile" "example" {
71+
account_id = var.cloudflare_account_id
72+
name = "Example device profile"
73+
description = "Example device profile recommended in the implementation documentation. For details, refer to https://developers.cloudflare.com/learning-paths/replace-vpn/configure-device-agent/device-profiles/"
74+
allow_mode_switch = false
75+
allow_updates = false
76+
allowed_to_leave = false
77+
auto_connect = 600
78+
captive_portal = 180
79+
disable_auto_fallback = true
80+
enabled = true
81+
exclude_office_ips = false
82+
precedence = 101
83+
service_mode_v2 = {mode = "warp"}
84+
support_url = "https://support.example.com"
85+
switch_locked = true
86+
tunnel_protocol = "wireguard"
87+
88+
match = trimspace(replace(<<-EOT
89+
identity.email in {"[email protected]"}
90+
or any(identity.groups.name[*] in {"developers" "admin"})
91+
and os.name == "windows"
92+
EOT
93+
, "\n", " "))
94+
}
6095
```
6196

62-
</TabItem> </Tabs>
97+
</TabItem>
98+
</Tabs>
6399

64100
## Edit profile settings
65101

0 commit comments

Comments
 (0)