Skip to content

Commit

Permalink
configure: create policy demo
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Jul 25, 2024
1 parent a01de46 commit 186415b
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions apps/configure/src/routes/(dash)/policies/(policies).tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { PageLayout, PageLayoutHeading } from "~/components/PageLayout";
import { SearchPage, createSearchPageContext } from "~/components/search";
import { useSyncEngine } from "~/lib/sync";

export default function Page() {
const sync = useSyncEngine();
const ctx = createSearchPageContext([
{
type: "enum",
Expand All @@ -13,6 +15,52 @@ export default function Page() {
return (
<PageLayout heading={<PageLayoutHeading>Policies</PageLayoutHeading>}>
<SearchPage {...ctx} showFilterBar={false} />

<button
type="button"
onClick={async () => {
const token = await sync.getAccessToken();

const resp = await fetch(
"https://graph.microsoft.com/beta/deviceManagement/configurationPolicies",
{
method: "POST",
headers: {
Authorization: token,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Created via API",
platforms: "windows10",
technologies: "mdm",
settings: [
{
"@odata.type":
"#microsoft.graph.deviceManagementConfigurationSetting",
settingInstance: {
"@odata.type":
"#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance",
settingDefinitionId:
"device_vendor_msft_policy_config_accounts_allowaddingnonmicrosoftaccountsmanually",
choiceSettingValue: {
"@odata.type":
"#microsoft.graph.deviceManagementConfigurationChoiceSettingValue",
value:
"device_vendor_msft_policy_config_accounts_allowaddingnonmicrosoftaccountsmanually_1",
children: [],
},
},
},
],
}),
},
);

console.log(await resp.text());
}}
>
Debug
</button>
</PageLayout>
);
}

0 comments on commit 186415b

Please sign in to comment.