Public/Set-MerakiOrganizationSmSentryPolicies.ps1
function Set-MerakiOrganizationSmSentryPolicies { <# .SYNOPSIS Sets Sentry Group Policies for an organization. .DESCRIPTION This function allows you to set Sentry Group Policies for an organization by providing the authentication token, organization ID, and a JSON string representing the policy assignments. .PARAMETER AuthToken The authentication token (API key) required to access the Meraki Dashboard API. .PARAMETER OrganizationId The ID of the organization. .PARAMETER PolicyAssignments A JSON string representing the Sentry Group Policies assignments for the organization. .EXAMPLE $PolicyAssignments = '{ "items": [ { "networkId": "N_24329156", "policies": [ { "policyId": "1284392014819", "smNetworkId": "N_24329156", "scope": "withAny", "tags": ["tag1", "tag2"], "groupPolicyId": "1284392014819" } ] } ] }' Set-MerakiOrganizationSmSentryPolicies -AuthToken "your-api-token" -OrganizationId "123456" -PolicyAssignments $PolicyAssignments This example sets Sentry Group Policies for the organization with ID "123456" using the provided JSON string. .NOTES For more information about the Meraki API, visit https://developer.cisco.com/meraki/api-v1/. #> [CmdletBinding()] param ( [parameter(Mandatory=$true)] [string]$AuthToken, [parameter(Mandatory=$true)] [string]$OrganizationId, [parameter(Mandatory=$true)] [string]$PolicyAssignments ) try { $header = @{ "X-Cisco-Meraki-API-Key" = $AuthToken "content-type" = "application/json; charset=utf-8" } $bodyJson = $PolicyAssignments $url = "https://api.meraki.com/api/v1/organizations/$OrganizationId/sm/sentry/policies/assignments" $response = Invoke-RestMethod -Method Put -Uri $url -headers $header -UserAgent "MerakiPowerShellModule/1.1.2 DocNougat" -Body $bodyJson return $response } catch { Write-Debug $_ Throw $_ } } |