Skip to content

Instantly share code, notes, and snippets.

@mrik23
mrik23 / arm_syntax.json
Created July 2, 2017 10:18
ARM Template syntax
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "",
"parameters": {
"<parameter-name>" : {
"type" : "<type-of-parameter-value>",
"defaultValue": "<default-value-of-parameter>",
"allowedValues": [ "<array-of-allowed-values>" ],
"minValue": <minimum-value-for-int>,
"maxValue": <maximum-value-for-int>,
@mrik23
mrik23 / azuredeploy.json
Created July 2, 2017 05:44
Basic ARM Template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [],
"outputs": {}
}
@mrik23
mrik23 / ps_json_cmdlets.ps1
Created July 2, 2017 05:35
PowerShell JSON Cmdlets
Get-Command *json*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet ConvertFrom-Json 3.1.0.0 Microsoft.PowerShell.Utility
Cmdlet ConvertTo-Json 3.1.0.0 Microsoft.PowerShell.Utility
@mrik23
mrik23 / objects_in_array.json
Created July 2, 2017 05:24
JSON Example 04
{
"servers":[
{
"server":"DC01",
"location":"Paris"
},
{
"server":"DC02",
"location":"London"
}
@mrik23
mrik23 / array.json
Last active July 2, 2017 05:20
JSON example 03
{
"servers":[ "DC001", "ADFS001", "WAP001" ]
}
@mrik23
mrik23 / two_pairs.json
Created July 2, 2017 05:12
JSON example 02
{
"server":"DC001",
"location":"Paris"
}
@mrik23
mrik23 / basic.json
Created July 2, 2017 04:55
JSON example 01
{ "server":"DC001" }
@mrik23
mrik23 / ActiveDirectory-BulkChangeAttributesWithFilteringOnUsers.ps1
Last active June 21, 2017 12:59
PowerShell script for Active Directory. In "one" line script we are able to retrieve users based on a specific attribute and update some attributes to them.
<#
This is an example on how to filter out users based on some standard filter and non-standard attribute.
In this case we pull all active users with the company Contoso, we force the attribute countryCode to be retrieved.
Then we select the users that have the countryCode empty and finally set the correct attributes for these users.
#>
$Users = Get-ADUser -Filter 'enabled -eq $true -and company -eq "Contoso"'`
-SearchBase "OU=Texas,DC=Contoso,DC=com"`
-Properties Department, Title, countryCode | `
where {$_.countryCode -eq ""} | `
@mrik23
mrik23 / AzureAD-ChangeSettingsUnifiedGroup.ps1
Last active May 26, 2017 08:55
PowerShell script to change Azure AD Directory Settings so basic users are not able to create Office 365 Groups AKA Unified Groups, a security group is added the right to create Office 365 Groups, and Guest users are blocked to join and access Office 365 Groups. This is a quick way to regain control on your tenant as an admin.
<#
Description:
This script modifies the existing Azure AD Directory Setting for Unified Groups with the objective to block users to create Office 365 Groups, and only allow users member of a dedicated security group.
Also it blocks external users to be added to Office 365 Groups (it's possible to by-pass this in applying a different setting to specific groups) and access Office 365 Groups.
It's recommended to run this script step by step PowerShell ISE. You can modify the settings or add others as you need.
Prerequisites:
- Install Azure Active Directory V2 PowerShell Module - Public Preview Release 2.0.0.114 from https://www.powershellgallery.com/packages/AzureADPreview/2.0.0.114
- Create a security group in your Azure AD tenant or local synced AD for users allowed to create Office 365 Groups