Upload Azure AAD B2C Premium Policy with Powershell
2016, Aug 02
If you like all of your interactions with Azure to be through Powershell (who doesn’t like to automate), then you’ll want to do the same thing for B2C Policies.
Don’t try this before you have your b2c directory whitelisted to work with the B2C Policy Upload feature. You’ll know if this is possible, if in the Azure Portal you’re able to upload a policy.
#Impo the b2c module #ExploreAdmin cmdlets will get rolled into the standard Azure Powershell module at some point. Cmdlets will undoubtably be renamed. #Until there is a better source, grab the dll from here; https://github.com/beejones/B2CDemoTools/blob/master/ExploreAdmin/ExploreAdmin.dll cd C:tempExploreAdmin import-module .ExploreAdmin.dll #Define user vars $tenantId = "mytenant.onmicrosoft.com" $policyFileLocation = "C:MyPoliciesPolicy1.xml" #Upload the policy, you'll be propmpted to login New-TrustFramework -TenantId $tenantId -ContentFilename $policyFileLocation -OverwriteIfExists -ShowRemoteError