cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 7

Applying Exchange Retention Policy with ARM Template Generator V2

Jump to solution

I make use of the ARM Template Generator V2 for our user account creation. So far all is working well.

However the only setting I'm unable to get working, is with the Exchange mailbox creation part. I would like the mailbox to be created and our corporate retention policy applied to it.

I would have to do this using the scripts field and using the powershell command set-mailbox -retentionpolicy "policyname" I'm told.

The question is, how do I tell it to apply it to the mailbox its just created?? I'm unsure which variables to use so that once its created the mailbox, it runs the script against that specific user account its just created.

I didnt want to clog up the thread regarding the actual tool itself so I thought I'd ask it here.

8paul​ Do you have any suggestions on how I can get this to work with your tool?

Cheers,

Bevan

0 Kudos
1 Solution
Level 10

Hi Bevan,

the script configuration in the template generator has a field for parameters that are passed to the script.

You can use one of these identifiers for the set-mailbox command: DN, SID, GUID, SAMAccountName

So in the parameters field you would have the value "{samaccountname}" (curly brackets required), then ARM will pass the samaccountname of the newly created user to the script.

How you access the variable in the script depends on the language you are using. For powershell you can either use the automatic $args variable or define your parameters in a param() definition.

Regards

Paul

View solution in original post

1 Reply
Level 10

Hi Bevan,

the script configuration in the template generator has a field for parameters that are passed to the script.

You can use one of these identifiers for the set-mailbox command: DN, SID, GUID, SAMAccountName

So in the parameters field you would have the value "{samaccountname}" (curly brackets required), then ARM will pass the samaccountname of the newly created user to the script.

How you access the variable in the script depends on the language you are using. For powershell you can either use the automatic $args variable or define your parameters in a param() definition.

Regards

Paul

View solution in original post