One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
In the request body, supply a JSON representation for the windowsInformationProtectionPolicy object.
The following table shows the properties that are required when you create the windowsInformationProtectionPolicy.
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceAppManagement/windowsInformationProtectionPolicies
Content-type: application/json
Content-length: 4303
{
"@odata.type": "#microsoft.graph.windowsInformationProtectionPolicy",
"displayName": "Display Name value",
"description": "Description value",
"version": "Version value",
"enforcementLevel": "encryptAndAuditOnly",
"enterpriseDomain": "Enterprise Domain value",
"enterpriseProtectedDomainNames": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",
"displayName": "Display Name value",
"resources": [
"Resources value"
]
}
],
"protectionUnderLockConfigRequired": true,
"dataRecoveryCertificate": {
"@odata.type": "microsoft.graph.windowsInformationProtectionDataRecoveryCertificate",
"subjectName": "Subject Name value",
"description": "Description value",
"expirationDateTime": "2016-12-31T23:57:57.2481234-08:00",
"certificate": "Y2VydGlmaWNhdGU="
},
"revokeOnUnenrollDisabled": true,
"rightsManagementServicesTemplateId": "abf7b16f-b16f-abf7-6fb1-f7ab6fb1f7ab",
"azureRightsManagementServicesAllowed": true,
"iconsVisible": true,
"protectedApps": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionStoreApp",
"displayName": "Display Name value",
"description": "Description value",
"publisherName": "Publisher Name value",
"productName": "Product Name value",
"denied": true
}
],
"exemptApps": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionStoreApp",
"displayName": "Display Name value",
"description": "Description value",
"publisherName": "Publisher Name value",
"productName": "Product Name value",
"denied": true
}
],
"enterpriseNetworkDomainNames": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",
"displayName": "Display Name value",
"resources": [
"Resources value"
]
}
],
"enterpriseProxiedDomains": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionProxiedDomainCollection",
"displayName": "Display Name value",
"proxiedDomains": [
{
"@odata.type": "microsoft.graph.proxiedDomain",
"ipAddressOrFQDN": "Ip Address Or FQDN value",
"proxy": "Proxy value"
}
]
}
],
"enterpriseIPRanges": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionIPRangeCollection",
"displayName": "Display Name value",
"ranges": [
{
"@odata.type": "microsoft.graph.ipRange"
}
]
}
],
"enterpriseIPRangesAreAuthoritative": true,
"enterpriseProxyServers": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",
"displayName": "Display Name value",
"resources": [
"Resources value"
]
}
],
"enterpriseInternalProxyServers": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",
"displayName": "Display Name value",
"resources": [
"Resources value"
]
}
],
"enterpriseProxyServersAreAuthoritative": true,
"neutralDomainResources": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",
"displayName": "Display Name value",
"resources": [
"Resources value"
]
}
],
"indexingEncryptedStoresOrItemsBlocked": true,
"smbAutoEncryptedFileExtensions": [
{
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",
"displayName": "Display Name value",
"resources": [
"Resources value"
]
}
],
"isAssigned": true,
"revokeOnMdmHandoffDisabled": true,
"mdmEnrollmentUrl": "https://example.com/mdmEnrollmentUrl/",
"windowsHelloForBusinessBlocked": true,
"pinMinimumLength": 0,
"pinUppercaseLetters": "requireAtLeastOne",
"pinLowercaseLetters": "requireAtLeastOne",
"pinSpecialCharacters": "requireAtLeastOne",
"pinExpirationDays": 1,
"numberOfPastPinsRemembered": 10,
"passwordMaximumAttemptCount": 11,
"minutesOfInactivityBeforeDeviceLock": 3,
"daysWithoutContactBeforeUnenroll": 0
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new WindowsInformationProtectionPolicy
{
OdataType = "#microsoft.graph.windowsInformationProtectionPolicy",
DisplayName = "Display Name value",
Description = "Description value",
Version = "Version value",
EnforcementLevel = WindowsInformationProtectionEnforcementLevel.EncryptAndAuditOnly,
EnterpriseDomain = "Enterprise Domain value",
EnterpriseProtectedDomainNames = new List<WindowsInformationProtectionResourceCollection>
{
new WindowsInformationProtectionResourceCollection
{
OdataType = "microsoft.graph.windowsInformationProtectionResourceCollection",
DisplayName = "Display Name value",
Resources = new List<string>
{
"Resources value",
},
},
},
ProtectionUnderLockConfigRequired = true,
DataRecoveryCertificate = new WindowsInformationProtectionDataRecoveryCertificate
{
OdataType = "microsoft.graph.windowsInformationProtectionDataRecoveryCertificate",
SubjectName = "Subject Name value",
Description = "Description value",
ExpirationDateTime = DateTimeOffset.Parse("2016-12-31T23:57:57.2481234-08:00"),
Certificate = Convert.FromBase64String("Y2VydGlmaWNhdGU="),
},
RevokeOnUnenrollDisabled = true,
RightsManagementServicesTemplateId = Guid.Parse("abf7b16f-b16f-abf7-6fb1-f7ab6fb1f7ab"),
AzureRightsManagementServicesAllowed = true,
IconsVisible = true,
ProtectedApps = new List<WindowsInformationProtectionApp>
{
new WindowsInformationProtectionStoreApp
{
OdataType = "microsoft.graph.windowsInformationProtectionStoreApp",
DisplayName = "Display Name value",
Description = "Description value",
PublisherName = "Publisher Name value",
ProductName = "Product Name value",
Denied = true,
},
},
ExemptApps = new List<WindowsInformationProtectionApp>
{
new WindowsInformationProtectionStoreApp
{
OdataType = "microsoft.graph.windowsInformationProtectionStoreApp",
DisplayName = "Display Name value",
Description = "Description value",
PublisherName = "Publisher Name value",
ProductName = "Product Name value",
Denied = true,
},
},
EnterpriseNetworkDomainNames = new List<WindowsInformationProtectionResourceCollection>
{
new WindowsInformationProtectionResourceCollection
{
OdataType = "microsoft.graph.windowsInformationProtectionResourceCollection",
DisplayName = "Display Name value",
Resources = new List<string>
{
"Resources value",
},
},
},
EnterpriseProxiedDomains = new List<WindowsInformationProtectionProxiedDomainCollection>
{
new WindowsInformationProtectionProxiedDomainCollection
{
OdataType = "microsoft.graph.windowsInformationProtectionProxiedDomainCollection",
DisplayName = "Display Name value",
ProxiedDomains = new List<ProxiedDomain>
{
new ProxiedDomain
{
OdataType = "microsoft.graph.proxiedDomain",
IpAddressOrFQDN = "Ip Address Or FQDN value",
Proxy = "Proxy value",
},
},
},
},
EnterpriseIPRanges = new List<WindowsInformationProtectionIPRangeCollection>
{
new WindowsInformationProtectionIPRangeCollection
{
OdataType = "microsoft.graph.windowsInformationProtectionIPRangeCollection",
DisplayName = "Display Name value",
Ranges = new List<IpRange>
{
new IpRange
{
OdataType = "microsoft.graph.ipRange",
},
},
},
},
EnterpriseIPRangesAreAuthoritative = true,
EnterpriseProxyServers = new List<WindowsInformationProtectionResourceCollection>
{
new WindowsInformationProtectionResourceCollection
{
OdataType = "microsoft.graph.windowsInformationProtectionResourceCollection",
DisplayName = "Display Name value",
Resources = new List<string>
{
"Resources value",
},
},
},
EnterpriseInternalProxyServers = new List<WindowsInformationProtectionResourceCollection>
{
new WindowsInformationProtectionResourceCollection
{
OdataType = "microsoft.graph.windowsInformationProtectionResourceCollection",
DisplayName = "Display Name value",
Resources = new List<string>
{
"Resources value",
},
},
},
EnterpriseProxyServersAreAuthoritative = true,
NeutralDomainResources = new List<WindowsInformationProtectionResourceCollection>
{
new WindowsInformationProtectionResourceCollection
{
OdataType = "microsoft.graph.windowsInformationProtectionResourceCollection",
DisplayName = "Display Name value",
Resources = new List<string>
{
"Resources value",
},
},
},
IndexingEncryptedStoresOrItemsBlocked = true,
SmbAutoEncryptedFileExtensions = new List<WindowsInformationProtectionResourceCollection>
{
new WindowsInformationProtectionResourceCollection
{
OdataType = "microsoft.graph.windowsInformationProtectionResourceCollection",
DisplayName = "Display Name value",
Resources = new List<string>
{
"Resources value",
},
},
},
IsAssigned = true,
RevokeOnMdmHandoffDisabled = true,
MdmEnrollmentUrl = "https://example.com/mdmEnrollmentUrl/",
WindowsHelloForBusinessBlocked = true,
PinMinimumLength = 0,
PinUppercaseLetters = WindowsInformationProtectionPinCharacterRequirements.RequireAtLeastOne,
PinLowercaseLetters = WindowsInformationProtectionPinCharacterRequirements.RequireAtLeastOne,
PinSpecialCharacters = WindowsInformationProtectionPinCharacterRequirements.RequireAtLeastOne,
PinExpirationDays = 1,
NumberOfPastPinsRemembered = 10,
PasswordMaximumAttemptCount = 11,
MinutesOfInactivityBeforeDeviceLock = 3,
DaysWithoutContactBeforeUnenroll = 0,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceAppManagement.WindowsInformationProtectionPolicies.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc device-app-management windows-information-protection-policies create --body '{\
"@odata.type": "#microsoft.graph.windowsInformationProtectionPolicy",\
"displayName": "Display Name value",\
"description": "Description value",\
"version": "Version value",\
"enforcementLevel": "encryptAndAuditOnly",\
"enterpriseDomain": "Enterprise Domain value",\
"enterpriseProtectedDomainNames": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",\
"displayName": "Display Name value",\
"resources": [\
"Resources value"\
]\
}\
],\
"protectionUnderLockConfigRequired": true,\
"dataRecoveryCertificate": {\
"@odata.type": "microsoft.graph.windowsInformationProtectionDataRecoveryCertificate",\
"subjectName": "Subject Name value",\
"description": "Description value",\
"expirationDateTime": "2016-12-31T23:57:57.2481234-08:00",\
"certificate": "Y2VydGlmaWNhdGU="\
},\
"revokeOnUnenrollDisabled": true,\
"rightsManagementServicesTemplateId": "abf7b16f-b16f-abf7-6fb1-f7ab6fb1f7ab",\
"azureRightsManagementServicesAllowed": true,\
"iconsVisible": true,\
"protectedApps": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionStoreApp",\
"displayName": "Display Name value",\
"description": "Description value",\
"publisherName": "Publisher Name value",\
"productName": "Product Name value",\
"denied": true\
}\
],\
"exemptApps": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionStoreApp",\
"displayName": "Display Name value",\
"description": "Description value",\
"publisherName": "Publisher Name value",\
"productName": "Product Name value",\
"denied": true\
}\
],\
"enterpriseNetworkDomainNames": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",\
"displayName": "Display Name value",\
"resources": [\
"Resources value"\
]\
}\
],\
"enterpriseProxiedDomains": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionProxiedDomainCollection",\
"displayName": "Display Name value",\
"proxiedDomains": [\
{\
"@odata.type": "microsoft.graph.proxiedDomain",\
"ipAddressOrFQDN": "Ip Address Or FQDN value",\
"proxy": "Proxy value"\
}\
]\
}\
],\
"enterpriseIPRanges": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionIPRangeCollection",\
"displayName": "Display Name value",\
"ranges": [\
{\
"@odata.type": "microsoft.graph.ipRange"\
}\
]\
}\
],\
"enterpriseIPRangesAreAuthoritative": true,\
"enterpriseProxyServers": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",\
"displayName": "Display Name value",\
"resources": [\
"Resources value"\
]\
}\
],\
"enterpriseInternalProxyServers": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",\
"displayName": "Display Name value",\
"resources": [\
"Resources value"\
]\
}\
],\
"enterpriseProxyServersAreAuthoritative": true,\
"neutralDomainResources": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",\
"displayName": "Display Name value",\
"resources": [\
"Resources value"\
]\
}\
],\
"indexingEncryptedStoresOrItemsBlocked": true,\
"smbAutoEncryptedFileExtensions": [\
{\
"@odata.type": "microsoft.graph.windowsInformationProtectionResourceCollection",\
"displayName": "Display Name value",\
"resources": [\
"Resources value"\
]\
}\
],\
"isAssigned": true,\
"revokeOnMdmHandoffDisabled": true,\
"mdmEnrollmentUrl": "https://example.com/mdmEnrollmentUrl/",\
"windowsHelloForBusinessBlocked": true,\
"pinMinimumLength": 0,\
"pinUppercaseLetters": "requireAtLeastOne",\
"pinLowercaseLetters": "requireAtLeastOne",\
"pinSpecialCharacters": "requireAtLeastOne",\
"pinExpirationDays": 1,\
"numberOfPastPinsRemembered": 10,\
"passwordMaximumAttemptCount": 11,\
"minutesOfInactivityBeforeDeviceLock": 3,\
"daysWithoutContactBeforeUnenroll": 0\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"github.com/google/uuid"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewWindowsInformationProtectionPolicy()
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
description := "Description value"
requestBody.SetDescription(&description)
version := "Version value"
requestBody.SetVersion(&version)
enforcementLevel := graphmodels.ENCRYPTANDAUDITONLY_WINDOWSINFORMATIONPROTECTIONENFORCEMENTLEVEL
requestBody.SetEnforcementLevel(&enforcementLevel)
enterpriseDomain := "Enterprise Domain value"
requestBody.SetEnterpriseDomain(&enterpriseDomain)
windowsInformationProtectionResourceCollection := graphmodels.NewWindowsInformationProtectionResourceCollection()
displayName := "Display Name value"
windowsInformationProtectionResourceCollection.SetDisplayName(&displayName)
resources := []string {
"Resources value",
}
windowsInformationProtectionResourceCollection.SetResources(resources)
enterpriseProtectedDomainNames := []graphmodels.WindowsInformationProtectionResourceCollectionable {
windowsInformationProtectionResourceCollection,
}
requestBody.SetEnterpriseProtectedDomainNames(enterpriseProtectedDomainNames)
protectionUnderLockConfigRequired := true
requestBody.SetProtectionUnderLockConfigRequired(&protectionUnderLockConfigRequired)
dataRecoveryCertificate := graphmodels.NewWindowsInformationProtectionDataRecoveryCertificate()
subjectName := "Subject Name value"
dataRecoveryCertificate.SetSubjectName(&subjectName)
description := "Description value"
dataRecoveryCertificate.SetDescription(&description)
expirationDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:57:57.2481234-08:00")
dataRecoveryCertificate.SetExpirationDateTime(&expirationDateTime)
certificate := []byte("y2VydGlmaWNhdGU=")
dataRecoveryCertificate.SetCertificate(&certificate)
requestBody.SetDataRecoveryCertificate(dataRecoveryCertificate)
revokeOnUnenrollDisabled := true
requestBody.SetRevokeOnUnenrollDisabled(&revokeOnUnenrollDisabled)
rightsManagementServicesTemplateId := uuid.MustParse("abf7b16f-b16f-abf7-6fb1-f7ab6fb1f7ab")
requestBody.SetRightsManagementServicesTemplateId(&rightsManagementServicesTemplateId)
azureRightsManagementServicesAllowed := true
requestBody.SetAzureRightsManagementServicesAllowed(&azureRightsManagementServicesAllowed)
iconsVisible := true
requestBody.SetIconsVisible(&iconsVisible)
windowsInformationProtectionApp := graphmodels.NewWindowsInformationProtectionStoreApp()
displayName := "Display Name value"
windowsInformationProtectionApp.SetDisplayName(&displayName)
description := "Description value"
windowsInformationProtectionApp.SetDescription(&description)
publisherName := "Publisher Name value"
windowsInformationProtectionApp.SetPublisherName(&publisherName)
productName := "Product Name value"
windowsInformationProtectionApp.SetProductName(&productName)
denied := true
windowsInformationProtectionApp.SetDenied(&denied)
protectedApps := []graphmodels.WindowsInformationProtectionAppable {
windowsInformationProtectionApp,
}
requestBody.SetProtectedApps(protectedApps)
windowsInformationProtectionApp := graphmodels.NewWindowsInformationProtectionStoreApp()
displayName := "Display Name value"
windowsInformationProtectionApp.SetDisplayName(&displayName)
description := "Description value"
windowsInformationProtectionApp.SetDescription(&description)
publisherName := "Publisher Name value"
windowsInformationProtectionApp.SetPublisherName(&publisherName)
productName := "Product Name value"
windowsInformationProtectionApp.SetProductName(&productName)
denied := true
windowsInformationProtectionApp.SetDenied(&denied)
exemptApps := []graphmodels.WindowsInformationProtectionAppable {
windowsInformationProtectionApp,
}
requestBody.SetExemptApps(exemptApps)
windowsInformationProtectionResourceCollection := graphmodels.NewWindowsInformationProtectionResourceCollection()
displayName := "Display Name value"
windowsInformationProtectionResourceCollection.SetDisplayName(&displayName)
resources := []string {
"Resources value",
}
windowsInformationProtectionResourceCollection.SetResources(resources)
enterpriseNetworkDomainNames := []graphmodels.WindowsInformationProtectionResourceCollectionable {
windowsInformationProtectionResourceCollection,
}
requestBody.SetEnterpriseNetworkDomainNames(enterpriseNetworkDomainNames)
windowsInformationProtectionProxiedDomainCollection := graphmodels.NewWindowsInformationProtectionProxiedDomainCollection()
displayName := "Display Name value"
windowsInformationProtectionProxiedDomainCollection.SetDisplayName(&displayName)
proxiedDomain := graphmodels.NewProxiedDomain()
ipAddressOrFQDN := "Ip Address Or FQDN value"
proxiedDomain.SetIpAddressOrFQDN(&ipAddressOrFQDN)
proxy := "Proxy value"
proxiedDomain.SetProxy(&proxy)
proxiedDomains := []graphmodels.ProxiedDomainable {
proxiedDomain,
}
windowsInformationProtectionProxiedDomainCollection.SetProxiedDomains(proxiedDomains)
enterpriseProxiedDomains := []graphmodels.WindowsInformationProtectionProxiedDomainCollectionable {
windowsInformationProtectionProxiedDomainCollection,
}
requestBody.SetEnterpriseProxiedDomains(enterpriseProxiedDomains)
windowsInformationProtectionIPRangeCollection := graphmodels.NewWindowsInformationProtectionIPRangeCollection()
displayName := "Display Name value"
windowsInformationProtectionIPRangeCollection.SetDisplayName(&displayName)
ipRange := graphmodels.NewIpRange()
ranges := []graphmodels.IpRangeable {
ipRange,
}
windowsInformationProtectionIPRangeCollection.SetRanges(ranges)
enterpriseIPRanges := []graphmodels.WindowsInformationProtectionIPRangeCollectionable {
windowsInformationProtectionIPRangeCollection,
}
requestBody.SetEnterpriseIPRanges(enterpriseIPRanges)
enterpriseIPRangesAreAuthoritative := true
requestBody.SetEnterpriseIPRangesAreAuthoritative(&enterpriseIPRangesAreAuthoritative)
windowsInformationProtectionResourceCollection := graphmodels.NewWindowsInformationProtectionResourceCollection()
displayName := "Display Name value"
windowsInformationProtectionResourceCollection.SetDisplayName(&displayName)
resources := []string {
"Resources value",
}
windowsInformationProtectionResourceCollection.SetResources(resources)
enterpriseProxyServers := []graphmodels.WindowsInformationProtectionResourceCollectionable {
windowsInformationProtectionResourceCollection,
}
requestBody.SetEnterpriseProxyServers(enterpriseProxyServers)
windowsInformationProtectionResourceCollection := graphmodels.NewWindowsInformationProtectionResourceCollection()
displayName := "Display Name value"
windowsInformationProtectionResourceCollection.SetDisplayName(&displayName)
resources := []string {
"Resources value",
}
windowsInformationProtectionResourceCollection.SetResources(resources)
enterpriseInternalProxyServers := []graphmodels.WindowsInformationProtectionResourceCollectionable {
windowsInformationProtectionResourceCollection,
}
requestBody.SetEnterpriseInternalProxyServers(enterpriseInternalProxyServers)
enterpriseProxyServersAreAuthoritative := true
requestBody.SetEnterpriseProxyServersAreAuthoritative(&enterpriseProxyServersAreAuthoritative)
windowsInformationProtectionResourceCollection := graphmodels.NewWindowsInformationProtectionResourceCollection()
displayName := "Display Name value"
windowsInformationProtectionResourceCollection.SetDisplayName(&displayName)
resources := []string {
"Resources value",
}
windowsInformationProtectionResourceCollection.SetResources(resources)
neutralDomainResources := []graphmodels.WindowsInformationProtectionResourceCollectionable {
windowsInformationProtectionResourceCollection,
}
requestBody.SetNeutralDomainResources(neutralDomainResources)
indexingEncryptedStoresOrItemsBlocked := true
requestBody.SetIndexingEncryptedStoresOrItemsBlocked(&indexingEncryptedStoresOrItemsBlocked)
windowsInformationProtectionResourceCollection := graphmodels.NewWindowsInformationProtectionResourceCollection()
displayName := "Display Name value"
windowsInformationProtectionResourceCollection.SetDisplayName(&displayName)
resources := []string {
"Resources value",
}
windowsInformationProtectionResourceCollection.SetResources(resources)
smbAutoEncryptedFileExtensions := []graphmodels.WindowsInformationProtectionResourceCollectionable {
windowsInformationProtectionResourceCollection,
}
requestBody.SetSmbAutoEncryptedFileExtensions(smbAutoEncryptedFileExtensions)
isAssigned := true
requestBody.SetIsAssigned(&isAssigned)
revokeOnMdmHandoffDisabled := true
requestBody.SetRevokeOnMdmHandoffDisabled(&revokeOnMdmHandoffDisabled)
mdmEnrollmentUrl := "https://example.com/mdmEnrollmentUrl/"
requestBody.SetMdmEnrollmentUrl(&mdmEnrollmentUrl)
windowsHelloForBusinessBlocked := true
requestBody.SetWindowsHelloForBusinessBlocked(&windowsHelloForBusinessBlocked)
pinMinimumLength := int32(0)
requestBody.SetPinMinimumLength(&pinMinimumLength)
pinUppercaseLetters := graphmodels.REQUIREATLEASTONE_WINDOWSINFORMATIONPROTECTIONPINCHARACTERREQUIREMENTS
requestBody.SetPinUppercaseLetters(&pinUppercaseLetters)
pinLowercaseLetters := graphmodels.REQUIREATLEASTONE_WINDOWSINFORMATIONPROTECTIONPINCHARACTERREQUIREMENTS
requestBody.SetPinLowercaseLetters(&pinLowercaseLetters)
pinSpecialCharacters := graphmodels.REQUIREATLEASTONE_WINDOWSINFORMATIONPROTECTIONPINCHARACTERREQUIREMENTS
requestBody.SetPinSpecialCharacters(&pinSpecialCharacters)
pinExpirationDays := int32(1)
requestBody.SetPinExpirationDays(&pinExpirationDays)
numberOfPastPinsRemembered := int32(10)
requestBody.SetNumberOfPastPinsRemembered(&numberOfPastPinsRemembered)
passwordMaximumAttemptCount := int32(11)
requestBody.SetPasswordMaximumAttemptCount(&passwordMaximumAttemptCount)
minutesOfInactivityBeforeDeviceLock := int32(3)
requestBody.SetMinutesOfInactivityBeforeDeviceLock(&minutesOfInactivityBeforeDeviceLock)
daysWithoutContactBeforeUnenroll := int32(0)
requestBody.SetDaysWithoutContactBeforeUnenroll(&daysWithoutContactBeforeUnenroll)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
windowsInformationProtectionPolicies, err := graphClient.DeviceAppManagement().WindowsInformationProtectionPolicies().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WindowsInformationProtectionPolicy windowsInformationProtectionPolicy = new WindowsInformationProtectionPolicy();
windowsInformationProtectionPolicy.setOdataType("#microsoft.graph.windowsInformationProtectionPolicy");
windowsInformationProtectionPolicy.setDisplayName("Display Name value");
windowsInformationProtectionPolicy.setDescription("Description value");
windowsInformationProtectionPolicy.setVersion("Version value");
windowsInformationProtectionPolicy.setEnforcementLevel(WindowsInformationProtectionEnforcementLevel.EncryptAndAuditOnly);
windowsInformationProtectionPolicy.setEnterpriseDomain("Enterprise Domain value");
LinkedList<WindowsInformationProtectionResourceCollection> enterpriseProtectedDomainNames = new LinkedList<WindowsInformationProtectionResourceCollection>();
WindowsInformationProtectionResourceCollection windowsInformationProtectionResourceCollection = new WindowsInformationProtectionResourceCollection();
windowsInformationProtectionResourceCollection.setOdataType("microsoft.graph.windowsInformationProtectionResourceCollection");
windowsInformationProtectionResourceCollection.setDisplayName("Display Name value");
LinkedList<String> resources = new LinkedList<String>();
resources.add("Resources value");
windowsInformationProtectionResourceCollection.setResources(resources);
enterpriseProtectedDomainNames.add(windowsInformationProtectionResourceCollection);
windowsInformationProtectionPolicy.setEnterpriseProtectedDomainNames(enterpriseProtectedDomainNames);
windowsInformationProtectionPolicy.setProtectionUnderLockConfigRequired(true);
WindowsInformationProtectionDataRecoveryCertificate dataRecoveryCertificate = new WindowsInformationProtectionDataRecoveryCertificate();
dataRecoveryCertificate.setOdataType("microsoft.graph.windowsInformationProtectionDataRecoveryCertificate");
dataRecoveryCertificate.setSubjectName("Subject Name value");
dataRecoveryCertificate.setDescription("Description value");
OffsetDateTime expirationDateTime = OffsetDateTime.parse("2016-12-31T23:57:57.2481234-08:00");
dataRecoveryCertificate.setExpirationDateTime(expirationDateTime);
byte[] certificate = Base64.getDecoder().decode("Y2VydGlmaWNhdGU=");
dataRecoveryCertificate.setCertificate(certificate);
windowsInformationProtectionPolicy.setDataRecoveryCertificate(dataRecoveryCertificate);
windowsInformationProtectionPolicy.setRevokeOnUnenrollDisabled(true);
windowsInformationProtectionPolicy.setRightsManagementServicesTemplateId(UUID.fromString("abf7b16f-b16f-abf7-6fb1-f7ab6fb1f7ab"));
windowsInformationProtectionPolicy.setAzureRightsManagementServicesAllowed(true);
windowsInformationProtectionPolicy.setIconsVisible(true);
LinkedList<WindowsInformationProtectionApp> protectedApps = new LinkedList<WindowsInformationProtectionApp>();
WindowsInformationProtectionStoreApp windowsInformationProtectionApp = new WindowsInformationProtectionStoreApp();
windowsInformationProtectionApp.setOdataType("microsoft.graph.windowsInformationProtectionStoreApp");
windowsInformationProtectionApp.setDisplayName("Display Name value");
windowsInformationProtectionApp.setDescription("Description value");
windowsInformationProtectionApp.setPublisherName("Publisher Name value");
windowsInformationProtectionApp.setProductName("Product Name value");
windowsInformationProtectionApp.setDenied(true);
protectedApps.add(windowsInformationProtectionApp);
windowsInformationProtectionPolicy.setProtectedApps(protectedApps);
LinkedList<WindowsInformationProtectionApp> exemptApps = new LinkedList<WindowsInformationProtectionApp>();
WindowsInformationProtectionStoreApp windowsInformationProtectionApp1 = new WindowsInformationProtectionStoreApp();
windowsInformationProtectionApp1.setOdataType("microsoft.graph.windowsInformationProtectionStoreApp");
windowsInformationProtectionApp1.setDisplayName("Display Name value");
windowsInformationProtectionApp1.setDescription("Description value");
windowsInformationProtectionApp1.setPublisherName("Publisher Name value");
windowsInformationProtectionApp1.setProductName("Product Name value");
windowsInformationProtectionApp1.setDenied(true);
exemptApps.add(windowsInformationProtectionApp1);
windowsInformationProtectionPolicy.setExemptApps(exemptApps);
LinkedList<WindowsInformationProtectionResourceCollection> enterpriseNetworkDomainNames = new LinkedList<WindowsInformationProtectionResourceCollection>();
WindowsInformationProtectionResourceCollection windowsInformationProtectionResourceCollection1 = new WindowsInformationProtectionResourceCollection();
windowsInformationProtectionResourceCollection1.setOdataType("microsoft.graph.windowsInformationProtectionResourceCollection");
windowsInformationProtectionResourceCollection1.setDisplayName("Display Name value");
LinkedList<String> resources1 = new LinkedList<String>();
resources1.add("Resources value");
windowsInformationProtectionResourceCollection1.setResources(resources1);
enterpriseNetworkDomainNames.add(windowsInformationProtectionResourceCollection1);
windowsInformationProtectionPolicy.setEnterpriseNetworkDomainNames(enterpriseNetworkDomainNames);
LinkedList<WindowsInformationProtectionProxiedDomainCollection> enterpriseProxiedDomains = new LinkedList<WindowsInformationProtectionProxiedDomainCollection>();
WindowsInformationProtectionProxiedDomainCollection windowsInformationProtectionProxiedDomainCollection = new WindowsInformationProtectionProxiedDomainCollection();
windowsInformationProtectionProxiedDomainCollection.setOdataType("microsoft.graph.windowsInformationProtectionProxiedDomainCollection");
windowsInformationProtectionProxiedDomainCollection.setDisplayName("Display Name value");
LinkedList<ProxiedDomain> proxiedDomains = new LinkedList<ProxiedDomain>();
ProxiedDomain proxiedDomain = new ProxiedDomain();
proxiedDomain.setOdataType("microsoft.graph.proxiedDomain");
proxiedDomain.setIpAddressOrFQDN("Ip Address Or FQDN value");
proxiedDomain.setProxy("Proxy value");
proxiedDomains.add(proxiedDomain);
windowsInformationProtectionProxiedDomainCollection.setProxiedDomains(proxiedDomains);
enterpriseProxiedDomains.add(windowsInformationProtectionProxiedDomainCollection);
windowsInformationProtectionPolicy.setEnterpriseProxiedDomains(enterpriseProxiedDomains);
LinkedList<WindowsInformationProtectionIPRangeCollection> enterpriseIPRanges = new LinkedList<WindowsInformationProtectionIPRangeCollection>();
WindowsInformationProtectionIPRangeCollection windowsInformationProtectionIPRangeCollection = new WindowsInformationProtectionIPRangeCollection();
windowsInformationProtectionIPRangeCollection.setOdataType("microsoft.graph.windowsInformationProtectionIPRangeCollection");
windowsInformationProtectionIPRangeCollection.setDisplayName("Display Name value");
LinkedList<IpRange> ranges = new LinkedList<IpRange>();
IpRange ipRange = new IpRange();
ipRange.setOdataType("microsoft.graph.ipRange");
ranges.add(ipRange);
windowsInformationProtectionIPRangeCollection.setRanges(ranges);
enterpriseIPRanges.add(windowsInformationProtectionIPRangeCollection);
windowsInformationProtectionPolicy.setEnterpriseIPRanges(enterpriseIPRanges);
windowsInformationProtectionPolicy.setEnterpriseIPRangesAreAuthoritative(true);
LinkedList<WindowsInformationProtectionResourceCollection> enterpriseProxyServers = new LinkedList<WindowsInformationProtectionResourceCollection>();
WindowsInformationProtectionResourceCollection windowsInformationProtectionResourceCollection2 = new WindowsInformationProtectionResourceCollection();
windowsInformationProtectionResourceCollection2.setOdataType("microsoft.graph.windowsInformationProtectionResourceCollection");
windowsInformationProtectionResourceCollection2.setDisplayName("Display Name value");
LinkedList<String> resources2 = new LinkedList<String>();
resources2.add("Resources value");
windowsInformationProtectionResourceCollection2.setResources(resources2);
enterpriseProxyServers.add(windowsInformationProtectionResourceCollection2);
windowsInformationProtectionPolicy.setEnterpriseProxyServers(enterpriseProxyServers);
LinkedList<WindowsInformationProtectionResourceCollection> enterpriseInternalProxyServers = new LinkedList<WindowsInformationProtectionResourceCollection>();
WindowsInformationProtectionResourceCollection windowsInformationProtectionResourceCollection3 = new WindowsInformationProtectionResourceCollection();
windowsInformationProtectionResourceCollection3.setOdataType("microsoft.graph.windowsInformationProtectionResourceCollection");
windowsInformationProtectionResourceCollection3.setDisplayName("Display Name value");
LinkedList<String> resources3 = new LinkedList<String>();
resources3.add("Resources value");
windowsInformationProtectionResourceCollection3.setResources(resources3);
enterpriseInternalProxyServers.add(windowsInformationProtectionResourceCollection3);
windowsInformationProtectionPolicy.setEnterpriseInternalProxyServers(enterpriseInternalProxyServers);
windowsInformationProtectionPolicy.setEnterpriseProxyServersAreAuthoritative(true);
LinkedList<WindowsInformationProtectionResourceCollection> neutralDomainResources = new LinkedList<WindowsInformationProtectionResourceCollection>();
WindowsInformationProtectionResourceCollection windowsInformationProtectionResourceCollection4 = new WindowsInformationProtectionResourceCollection();
windowsInformationProtectionResourceCollection4.setOdataType("microsoft.graph.windowsInformationProtectionResourceCollection");
windowsInformationProtectionResourceCollection4.setDisplayName("Display Name value");
LinkedList<String> resources4 = new LinkedList<String>();
resources4.add("Resources value");
windowsInformationProtectionResourceCollection4.setResources(resources4);
neutralDomainResources.add(windowsInformationProtectionResourceCollection4);
windowsInformationProtectionPolicy.setNeutralDomainResources(neutralDomainResources);
windowsInformationProtectionPolicy.setIndexingEncryptedStoresOrItemsBlocked(true);
LinkedList<WindowsInformationProtectionResourceCollection> smbAutoEncryptedFileExtensions = new LinkedList<WindowsInformationProtectionResourceCollection>();
WindowsInformationProtectionResourceCollection windowsInformationProtectionResourceCollection5 = new WindowsInformationProtectionResourceCollection();
windowsInformationProtectionResourceCollection5.setOdataType("microsoft.graph.windowsInformationProtectionResourceCollection");
windowsInformationProtectionResourceCollection5.setDisplayName("Display Name value");
LinkedList<String> resources5 = new LinkedList<String>();
resources5.add("Resources value");
windowsInformationProtectionResourceCollection5.setResources(resources5);
smbAutoEncryptedFileExtensions.add(windowsInformationProtectionResourceCollection5);
windowsInformationProtectionPolicy.setSmbAutoEncryptedFileExtensions(smbAutoEncryptedFileExtensions);
windowsInformationProtectionPolicy.setIsAssigned(true);
windowsInformationProtectionPolicy.setRevokeOnMdmHandoffDisabled(true);
windowsInformationProtectionPolicy.setMdmEnrollmentUrl("https://example.com/mdmEnrollmentUrl/");
windowsInformationProtectionPolicy.setWindowsHelloForBusinessBlocked(true);
windowsInformationProtectionPolicy.setPinMinimumLength(0);
windowsInformationProtectionPolicy.setPinUppercaseLetters(WindowsInformationProtectionPinCharacterRequirements.RequireAtLeastOne);
windowsInformationProtectionPolicy.setPinLowercaseLetters(WindowsInformationProtectionPinCharacterRequirements.RequireAtLeastOne);
windowsInformationProtectionPolicy.setPinSpecialCharacters(WindowsInformationProtectionPinCharacterRequirements.RequireAtLeastOne);
windowsInformationProtectionPolicy.setPinExpirationDays(1);
windowsInformationProtectionPolicy.setNumberOfPastPinsRemembered(10);
windowsInformationProtectionPolicy.setPasswordMaximumAttemptCount(11);
windowsInformationProtectionPolicy.setMinutesOfInactivityBeforeDeviceLock(3);
windowsInformationProtectionPolicy.setDaysWithoutContactBeforeUnenroll(0);
WindowsInformationProtectionPolicy result = graphClient.deviceAppManagement().windowsInformationProtectionPolicies().post(windowsInformationProtectionPolicy);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const windowsInformationProtectionPolicy = {
'@odata.type': '#microsoft.graph.windowsInformationProtectionPolicy',
displayName: 'Display Name value',
description: 'Description value',
version: 'Version value',
enforcementLevel: 'encryptAndAuditOnly',
enterpriseDomain: 'Enterprise Domain value',
enterpriseProtectedDomainNames: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionResourceCollection',
displayName: 'Display Name value',
resources: [
'Resources value'
]
}
],
protectionUnderLockConfigRequired: true,
dataRecoveryCertificate: {
'@odata.type': 'microsoft.graph.windowsInformationProtectionDataRecoveryCertificate',
subjectName: 'Subject Name value',
description: 'Description value',
expirationDateTime: '2016-12-31T23:57:57.2481234-08:00',
certificate: 'Y2VydGlmaWNhdGU='
},
revokeOnUnenrollDisabled: true,
rightsManagementServicesTemplateId: 'abf7b16f-b16f-abf7-6fb1-f7ab6fb1f7ab',
azureRightsManagementServicesAllowed: true,
iconsVisible: true,
protectedApps: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionStoreApp',
displayName: 'Display Name value',
description: 'Description value',
publisherName: 'Publisher Name value',
productName: 'Product Name value',
denied: true
}
],
exemptApps: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionStoreApp',
displayName: 'Display Name value',
description: 'Description value',
publisherName: 'Publisher Name value',
productName: 'Product Name value',
denied: true
}
],
enterpriseNetworkDomainNames: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionResourceCollection',
displayName: 'Display Name value',
resources: [
'Resources value'
]
}
],
enterpriseProxiedDomains: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionProxiedDomainCollection',
displayName: 'Display Name value',
proxiedDomains: [
{
'@odata.type': 'microsoft.graph.proxiedDomain',
ipAddressOrFQDN: 'Ip Address Or FQDN value',
proxy: 'Proxy value'
}
]
}
],
enterpriseIPRanges: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionIPRangeCollection',
displayName: 'Display Name value',
ranges: [
{
'@odata.type': 'microsoft.graph.ipRange'
}
]
}
],
enterpriseIPRangesAreAuthoritative: true,
enterpriseProxyServers: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionResourceCollection',
displayName: 'Display Name value',
resources: [
'Resources value'
]
}
],
enterpriseInternalProxyServers: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionResourceCollection',
displayName: 'Display Name value',
resources: [
'Resources value'
]
}
],
enterpriseProxyServersAreAuthoritative: true,
neutralDomainResources: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionResourceCollection',
displayName: 'Display Name value',
resources: [
'Resources value'
]
}
],
indexingEncryptedStoresOrItemsBlocked: true,
smbAutoEncryptedFileExtensions: [
{
'@odata.type': 'microsoft.graph.windowsInformationProtectionResourceCollection',
displayName: 'Display Name value',
resources: [
'Resources value'
]
}
],
isAssigned: true,
revokeOnMdmHandoffDisabled: true,
mdmEnrollmentUrl: 'https://example.com/mdmEnrollmentUrl/',
windowsHelloForBusinessBlocked: true,
pinMinimumLength: 0,
pinUppercaseLetters: 'requireAtLeastOne',
pinLowercaseLetters: 'requireAtLeastOne',
pinSpecialCharacters: 'requireAtLeastOne',
pinExpirationDays: 1,
numberOfPastPinsRemembered: 10,
passwordMaximumAttemptCount: 11,
minutesOfInactivityBeforeDeviceLock: 3,
daysWithoutContactBeforeUnenroll: 0
};
await client.api('/deviceAppManagement/windowsInformationProtectionPolicies')
.post(windowsInformationProtectionPolicy);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\WindowsInformationProtectionPolicy;
use Microsoft\Graph\Generated\Models\WindowsInformationProtectionEnforcementLevel;
use Microsoft\Graph\Generated\Models\WindowsInformationProtectionResourceCollection;
use Microsoft\Graph\Generated\Models\WindowsInformationProtectionDataRecoveryCertificate;
use Microsoft\Graph\Generated\Models\WindowsInformationProtectionApp;
use Microsoft\Graph\Generated\Models\WindowsInformationProtectionStoreApp;
use Microsoft\Graph\Generated\Models\WindowsInformationProtectionProxiedDomainCollection;
use Microsoft\Graph\Generated\Models\ProxiedDomain;
use Microsoft\Graph\Generated\Models\WindowsInformationProtectionIPRangeCollection;
use Microsoft\Graph\Generated\Models\IpRange;
use Microsoft\Graph\Generated\Models\WindowsInformationProtectionPinCharacterRequirements;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WindowsInformationProtectionPolicy();
$requestBody->setOdataType('#microsoft.graph.windowsInformationProtectionPolicy');
$requestBody->setDisplayName('Display Name value');
$requestBody->setDescription('Description value');
$requestBody->setVersion('Version value');
$requestBody->setEnforcementLevel(new WindowsInformationProtectionEnforcementLevel('encryptAndAuditOnly'));
$requestBody->setEnterpriseDomain('Enterprise Domain value');
$enterpriseProtectedDomainNamesWindowsInformationProtectionResourceCollection1 = new WindowsInformationProtectionResourceCollection();
$enterpriseProtectedDomainNamesWindowsInformationProtectionResourceCollection1->setOdataType('microsoft.graph.windowsInformationProtectionResourceCollection');
$enterpriseProtectedDomainNamesWindowsInformationProtectionResourceCollection1->setDisplayName('Display Name value');
$enterpriseProtectedDomainNamesWindowsInformationProtectionResourceCollection1->setResources(['Resources value', ]);
$enterpriseProtectedDomainNamesArray []= $enterpriseProtectedDomainNamesWindowsInformationProtectionResourceCollection1;
$requestBody->setEnterpriseProtectedDomainNames($enterpriseProtectedDomainNamesArray);
$requestBody->setProtectionUnderLockConfigRequired(true);
$dataRecoveryCertificate = new WindowsInformationProtectionDataRecoveryCertificate();
$dataRecoveryCertificate->setOdataType('microsoft.graph.windowsInformationProtectionDataRecoveryCertificate');
$dataRecoveryCertificate->setSubjectName('Subject Name value');
$dataRecoveryCertificate->setDescription('Description value');
$dataRecoveryCertificate->setExpirationDateTime(new \DateTime('2016-12-31T23:57:57.2481234-08:00'));
$dataRecoveryCertificate->setCertificate(\GuzzleHttp\Psr7\Utils::streamFor(base64_decode('Y2VydGlmaWNhdGU=')));
$requestBody->setDataRecoveryCertificate($dataRecoveryCertificate);
$requestBody->setRevokeOnUnenrollDisabled(true);
$requestBody->setRightsManagementServicesTemplateId('abf7b16f-b16f-abf7-6fb1-f7ab6fb1f7ab');
$requestBody->setAzureRightsManagementServicesAllowed(true);
$requestBody->setIconsVisible(true);
$protectedAppsWindowsInformationProtectionApp1 = new WindowsInformationProtectionStoreApp();
$protectedAppsWindowsInformationProtectionApp1->setOdataType('microsoft.graph.windowsInformationProtectionStoreApp');
$protectedAppsWindowsInformationProtectionApp1->setDisplayName('Display Name value');
$protectedAppsWindowsInformationProtectionApp1->setDescription('Description value');
$protectedAppsWindowsInformationProtectionApp1->setPublisherName('Publisher Name value');
$protectedAppsWindowsInformationProtectionApp1->setProductName('Product Name value');
$protectedAppsWindowsInformationProtectionApp1->setDenied(true);
$protectedAppsArray []= $protectedAppsWindowsInformationProtectionApp1;
$requestBody->setProtectedApps($protectedAppsArray);
$exemptAppsWindowsInformationProtectionApp1 = new WindowsInformationProtectionStoreApp();
$exemptAppsWindowsInformationProtectionApp1->setOdataType('microsoft.graph.windowsInformationProtectionStoreApp');
$exemptAppsWindowsInformationProtectionApp1->setDisplayName('Display Name value');
$exemptAppsWindowsInformationProtectionApp1->setDescription('Description value');
$exemptAppsWindowsInformationProtectionApp1->setPublisherName('Publisher Name value');
$exemptAppsWindowsInformationProtectionApp1->setProductName('Product Name value');
$exemptAppsWindowsInformationProtectionApp1->setDenied(true);
$exemptAppsArray []= $exemptAppsWindowsInformationProtectionApp1;
$requestBody->setExemptApps($exemptAppsArray);
$enterpriseNetworkDomainNamesWindowsInformationProtectionResourceCollection1 = new WindowsInformationProtectionResourceCollection();
$enterpriseNetworkDomainNamesWindowsInformationProtectionResourceCollection1->setOdataType('microsoft.graph.windowsInformationProtectionResourceCollection');
$enterpriseNetworkDomainNamesWindowsInformationProtectionResourceCollection1->setDisplayName('Display Name value');
$enterpriseNetworkDomainNamesWindowsInformationProtectionResourceCollection1->setResources(['Resources value', ]);
$enterpriseNetworkDomainNamesArray []= $enterpriseNetworkDomainNamesWindowsInformationProtectionResourceCollection1;
$requestBody->setEnterpriseNetworkDomainNames($enterpriseNetworkDomainNamesArray);
$enterpriseProxiedDomainsWindowsInformationProtectionProxiedDomainCollection1 = new WindowsInformationProtectionProxiedDomainCollection();
$enterpriseProxiedDomainsWindowsInformationProtectionProxiedDomainCollection1->setOdataType('microsoft.graph.windowsInformationProtectionProxiedDomainCollection');
$enterpriseProxiedDomainsWindowsInformationProtectionProxiedDomainCollection1->setDisplayName('Display Name value');
$proxiedDomainsProxiedDomain1 = new ProxiedDomain();
$proxiedDomainsProxiedDomain1->setOdataType('microsoft.graph.proxiedDomain');
$proxiedDomainsProxiedDomain1->setIpAddressOrFQDN('Ip Address Or FQDN value');
$proxiedDomainsProxiedDomain1->setProxy('Proxy value');
$proxiedDomainsArray []= $proxiedDomainsProxiedDomain1;
$enterpriseProxiedDomainsWindowsInformationProtectionProxiedDomainCollection1->setProxiedDomains($proxiedDomainsArray);
$enterpriseProxiedDomainsArray []= $enterpriseProxiedDomainsWindowsInformationProtectionProxiedDomainCollection1;
$requestBody->setEnterpriseProxiedDomains($enterpriseProxiedDomainsArray);
$enterpriseIPRangesWindowsInformationProtectionIPRangeCollection1 = new WindowsInformationProtectionIPRangeCollection();
$enterpriseIPRangesWindowsInformationProtectionIPRangeCollection1->setOdataType('microsoft.graph.windowsInformationProtectionIPRangeCollection');
$enterpriseIPRangesWindowsInformationProtectionIPRangeCollection1->setDisplayName('Display Name value');
$rangesIpRange1 = new IpRange();
$rangesIpRange1->setOdataType('microsoft.graph.ipRange');
$rangesArray []= $rangesIpRange1;
$enterpriseIPRangesWindowsInformationProtectionIPRangeCollection1->setRanges($rangesArray);
$enterpriseIPRangesArray []= $enterpriseIPRangesWindowsInformationProtectionIPRangeCollection1;
$requestBody->setEnterpriseIPRanges($enterpriseIPRangesArray);
$requestBody->setEnterpriseIPRangesAreAuthoritative(true);
$enterpriseProxyServersWindowsInformationProtectionResourceCollection1 = new WindowsInformationProtectionResourceCollection();
$enterpriseProxyServersWindowsInformationProtectionResourceCollection1->setOdataType('microsoft.graph.windowsInformationProtectionResourceCollection');
$enterpriseProxyServersWindowsInformationProtectionResourceCollection1->setDisplayName('Display Name value');
$enterpriseProxyServersWindowsInformationProtectionResourceCollection1->setResources(['Resources value', ]);
$enterpriseProxyServersArray []= $enterpriseProxyServersWindowsInformationProtectionResourceCollection1;
$requestBody->setEnterpriseProxyServers($enterpriseProxyServersArray);
$enterpriseInternalProxyServersWindowsInformationProtectionResourceCollection1 = new WindowsInformationProtectionResourceCollection();
$enterpriseInternalProxyServersWindowsInformationProtectionResourceCollection1->setOdataType('microsoft.graph.windowsInformationProtectionResourceCollection');
$enterpriseInternalProxyServersWindowsInformationProtectionResourceCollection1->setDisplayName('Display Name value');
$enterpriseInternalProxyServersWindowsInformationProtectionResourceCollection1->setResources(['Resources value', ]);
$enterpriseInternalProxyServersArray []= $enterpriseInternalProxyServersWindowsInformationProtectionResourceCollection1;
$requestBody->setEnterpriseInternalProxyServers($enterpriseInternalProxyServersArray);
$requestBody->setEnterpriseProxyServersAreAuthoritative(true);
$neutralDomainResourcesWindowsInformationProtectionResourceCollection1 = new WindowsInformationProtectionResourceCollection();
$neutralDomainResourcesWindowsInformationProtectionResourceCollection1->setOdataType('microsoft.graph.windowsInformationProtectionResourceCollection');
$neutralDomainResourcesWindowsInformationProtectionResourceCollection1->setDisplayName('Display Name value');
$neutralDomainResourcesWindowsInformationProtectionResourceCollection1->setResources(['Resources value', ]);
$neutralDomainResourcesArray []= $neutralDomainResourcesWindowsInformationProtectionResourceCollection1;
$requestBody->setNeutralDomainResources($neutralDomainResourcesArray);
$requestBody->setIndexingEncryptedStoresOrItemsBlocked(true);
$smbAutoEncryptedFileExtensionsWindowsInformationProtectionResourceCollection1 = new WindowsInformationProtectionResourceCollection();
$smbAutoEncryptedFileExtensionsWindowsInformationProtectionResourceCollection1->setOdataType('microsoft.graph.windowsInformationProtectionResourceCollection');
$smbAutoEncryptedFileExtensionsWindowsInformationProtectionResourceCollection1->setDisplayName('Display Name value');
$smbAutoEncryptedFileExtensionsWindowsInformationProtectionResourceCollection1->setResources(['Resources value', ]);
$smbAutoEncryptedFileExtensionsArray []= $smbAutoEncryptedFileExtensionsWindowsInformationProtectionResourceCollection1;
$requestBody->setSmbAutoEncryptedFileExtensions($smbAutoEncryptedFileExtensionsArray);
$requestBody->setIsAssigned(true);
$requestBody->setRevokeOnMdmHandoffDisabled(true);
$requestBody->setMdmEnrollmentUrl('https://example.com/mdmEnrollmentUrl/');
$requestBody->setWindowsHelloForBusinessBlocked(true);
$requestBody->setPinMinimumLength(0);
$requestBody->setPinUppercaseLetters(new WindowsInformationProtectionPinCharacterRequirements('requireAtLeastOne'));
$requestBody->setPinLowercaseLetters(new WindowsInformationProtectionPinCharacterRequirements('requireAtLeastOne'));
$requestBody->setPinSpecialCharacters(new WindowsInformationProtectionPinCharacterRequirements('requireAtLeastOne'));
$requestBody->setPinExpirationDays(1);
$requestBody->setNumberOfPastPinsRemembered(10);
$requestBody->setPasswordMaximumAttemptCount(11);
$requestBody->setMinutesOfInactivityBeforeDeviceLock(3);
$requestBody->setDaysWithoutContactBeforeUnenroll(0);
$result = $graphServiceClient->deviceAppManagement()->windowsInformationProtectionPolicies()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Devices.CorporateManagement
$params = @{
"@odata.type" = "#microsoft.graph.windowsInformationProtectionPolicy"
displayName = "Display Name value"
description = "Description value"
version = "Version value"
enforcementLevel = "encryptAndAuditOnly"
enterpriseDomain = "Enterprise Domain value"
enterpriseProtectedDomainNames = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionResourceCollection"
displayName = "Display Name value"
resources = @(
"Resources value"
)
}
)
protectionUnderLockConfigRequired = $true
dataRecoveryCertificate = @{
"@odata.type" = "microsoft.graph.windowsInformationProtectionDataRecoveryCertificate"
subjectName = "Subject Name value"
description = "Description value"
expirationDateTime = [System.DateTime]::Parse("2016-12-31T23:57:57.2481234-08:00")
certificate = [System.Text.Encoding]::ASCII.GetBytes("Y2VydGlmaWNhdGU=")
}
revokeOnUnenrollDisabled = $true
rightsManagementServicesTemplateId = "abf7b16f-b16f-abf7-6fb1-f7ab6fb1f7ab"
azureRightsManagementServicesAllowed = $true
iconsVisible = $true
protectedApps = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionStoreApp"
displayName = "Display Name value"
description = "Description value"
publisherName = "Publisher Name value"
productName = "Product Name value"
denied = $true
}
)
exemptApps = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionStoreApp"
displayName = "Display Name value"
description = "Description value"
publisherName = "Publisher Name value"
productName = "Product Name value"
denied = $true
}
)
enterpriseNetworkDomainNames = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionResourceCollection"
displayName = "Display Name value"
resources = @(
"Resources value"
)
}
)
enterpriseProxiedDomains = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionProxiedDomainCollection"
displayName = "Display Name value"
proxiedDomains = @(
@{
"@odata.type" = "microsoft.graph.proxiedDomain"
ipAddressOrFQDN = "Ip Address Or FQDN value"
proxy = "Proxy value"
}
)
}
)
enterpriseIPRanges = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionIPRangeCollection"
displayName = "Display Name value"
ranges = @(
@{
"@odata.type" = "microsoft.graph.ipRange"
}
)
}
)
enterpriseIPRangesAreAuthoritative = $true
enterpriseProxyServers = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionResourceCollection"
displayName = "Display Name value"
resources = @(
"Resources value"
)
}
)
enterpriseInternalProxyServers = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionResourceCollection"
displayName = "Display Name value"
resources = @(
"Resources value"
)
}
)
enterpriseProxyServersAreAuthoritative = $true
neutralDomainResources = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionResourceCollection"
displayName = "Display Name value"
resources = @(
"Resources value"
)
}
)
indexingEncryptedStoresOrItemsBlocked = $true
smbAutoEncryptedFileExtensions = @(
@{
"@odata.type" = "microsoft.graph.windowsInformationProtectionResourceCollection"
displayName = "Display Name value"
resources = @(
"Resources value"
)
}
)
isAssigned = $true
revokeOnMdmHandoffDisabled = $true
mdmEnrollmentUrl = "https://example.com/mdmEnrollmentUrl/"
windowsHelloForBusinessBlocked = $true
pinMinimumLength = 0
pinUppercaseLetters = "requireAtLeastOne"
pinLowercaseLetters = "requireAtLeastOne"
pinSpecialCharacters = "requireAtLeastOne"
pinExpirationDays = 1
numberOfPastPinsRemembered = 10
passwordMaximumAttemptCount = 11
minutesOfInactivityBeforeDeviceLock = 3
daysWithoutContactBeforeUnenroll = 0
}
New-MgDeviceAppManagementWindowsInformationProtectionPolicy -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.windows_information_protection_policy import WindowsInformationProtectionPolicy
from msgraph.generated.models.windows_information_protection_enforcement_level import WindowsInformationProtectionEnforcementLevel
from msgraph.generated.models.windows_information_protection_resource_collection import WindowsInformationProtectionResourceCollection
from msgraph.generated.models.windows_information_protection_data_recovery_certificate import WindowsInformationProtectionDataRecoveryCertificate
from msgraph.generated.models.windows_information_protection_app import WindowsInformationProtectionApp
from msgraph.generated.models.windows_information_protection_store_app import WindowsInformationProtectionStoreApp
from msgraph.generated.models.windows_information_protection_proxied_domain_collection import WindowsInformationProtectionProxiedDomainCollection
from msgraph.generated.models.proxied_domain import ProxiedDomain
from msgraph.generated.models.windows_information_protection_i_p_range_collection import WindowsInformationProtectionIPRangeCollection
from msgraph.generated.models.ip_range import IpRange
from msgraph.generated.models.windows_information_protection_pin_character_requirements import WindowsInformationProtectionPinCharacterRequirements
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WindowsInformationProtectionPolicy(
odata_type = "#microsoft.graph.windowsInformationProtectionPolicy",
display_name = "Display Name value",
description = "Description value",
version = "Version value",
enforcement_level = WindowsInformationProtectionEnforcementLevel.EncryptAndAuditOnly,
enterprise_domain = "Enterprise Domain value",
enterprise_protected_domain_names = [
WindowsInformationProtectionResourceCollection(
odata_type = "microsoft.graph.windowsInformationProtectionResourceCollection",
display_name = "Display Name value",
resources = [
"Resources value",
],
),
],
protection_under_lock_config_required = True,
data_recovery_certificate = WindowsInformationProtectionDataRecoveryCertificate(
odata_type = "microsoft.graph.windowsInformationProtectionDataRecoveryCertificate",
subject_name = "Subject Name value",
description = "Description value",
expiration_date_time = "2016-12-31T23:57:57.2481234-08:00",
certificate = base64.urlsafe_b64decode("Y2VydGlmaWNhdGU="),
),
revoke_on_unenroll_disabled = True,
rights_management_services_template_id = UUID("abf7b16f-b16f-abf7-6fb1-f7ab6fb1f7ab"),
azure_rights_management_services_allowed = True,
icons_visible = True,
protected_apps = [
WindowsInformationProtectionStoreApp(
odata_type = "microsoft.graph.windowsInformationProtectionStoreApp",
display_name = "Display Name value",
description = "Description value",
publisher_name = "Publisher Name value",
product_name = "Product Name value",
denied = True,
),
],
exempt_apps = [
WindowsInformationProtectionStoreApp(
odata_type = "microsoft.graph.windowsInformationProtectionStoreApp",
display_name = "Display Name value",
description = "Description value",
publisher_name = "Publisher Name value",
product_name = "Product Name value",
denied = True,
),
],
enterprise_network_domain_names = [
WindowsInformationProtectionResourceCollection(
odata_type = "microsoft.graph.windowsInformationProtectionResourceCollection",
display_name = "Display Name value",
resources = [
"Resources value",
],
),
],
enterprise_proxied_domains = [
WindowsInformationProtectionProxiedDomainCollection(
odata_type = "microsoft.graph.windowsInformationProtectionProxiedDomainCollection",
display_name = "Display Name value",
proxied_domains = [
ProxiedDomain(
odata_type = "microsoft.graph.proxiedDomain",
ip_address_or_f_q_d_n = "Ip Address Or FQDN value",
proxy = "Proxy value",
),
],
),
],
enterprise_i_p_ranges = [
WindowsInformationProtectionIPRangeCollection(
odata_type = "microsoft.graph.windowsInformationProtectionIPRangeCollection",
display_name = "Display Name value",
ranges = [
IpRange(
odata_type = "microsoft.graph.ipRange",
),
],
),
],
enterprise_i_p_ranges_are_authoritative = True,
enterprise_proxy_servers = [
WindowsInformationProtectionResourceCollection(
odata_type = "microsoft.graph.windowsInformationProtectionResourceCollection",
display_name = "Display Name value",
resources = [
"Resources value",
],
),
],
enterprise_internal_proxy_servers = [
WindowsInformationProtectionResourceCollection(
odata_type = "microsoft.graph.windowsInformationProtectionResourceCollection",
display_name = "Display Name value",
resources = [
"Resources value",
],
),
],
enterprise_proxy_servers_are_authoritative = True,
neutral_domain_resources = [
WindowsInformationProtectionResourceCollection(
odata_type = "microsoft.graph.windowsInformationProtectionResourceCollection",
display_name = "Display Name value",
resources = [
"Resources value",
],
),
],
indexing_encrypted_stores_or_items_blocked = True,
smb_auto_encrypted_file_extensions = [
WindowsInformationProtectionResourceCollection(
odata_type = "microsoft.graph.windowsInformationProtectionResourceCollection",
display_name = "Display Name value",
resources = [
"Resources value",
],
),
],
is_assigned = True,
revoke_on_mdm_handoff_disabled = True,
mdm_enrollment_url = "https://example.com/mdmEnrollmentUrl/",
windows_hello_for_business_blocked = True,
pin_minimum_length = 0,
pin_uppercase_letters = WindowsInformationProtectionPinCharacterRequirements.RequireAtLeastOne,
pin_lowercase_letters = WindowsInformationProtectionPinCharacterRequirements.RequireAtLeastOne,
pin_special_characters = WindowsInformationProtectionPinCharacterRequirements.RequireAtLeastOne,
pin_expiration_days = 1,
number_of_past_pins_remembered = 10,
password_maximum_attempt_count = 11,
minutes_of_inactivity_before_device_lock = 3,
days_without_contact_before_unenroll = 0,
)
result = await graph_client.device_app_management.windows_information_protection_policies.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.