Post Deploy Set Folder Permission

Currently have a deployment of a .net5.0 package and upon deploying to the IIS server one of the folders needs IUSR and IIS_IUSR permissions on it.

When deploying a .net framework package these permissions seem to already be there so as a way forward I was thinking of using a Post-Deployment script to add in these 2 permissions on the folder in question.

Any help on doing this, or if its possible, as I cannot find anything on the net showing how to do it

Hi @jacob.spencer,

Thanks for reaching out and welcome to our community forums!

It’s an interesting question, and while it’s definitely possible to use a post-deployment script to modify permissions on the folders it would be worth looking into why .NET framework packages seem to have the permissions baked in as I don’t believe Octopus performs any modifications during deployment.

Is it possible that when deploying the .NET 5.0 package it’s being deployed to a different root folder than the .NET framework package, perhaps with different permissions being inherited (or not inherited)?

In terms of a script that could add the user permissions to a directory, this may be a handy starting point:

$directory = "C:\Folder\Path\"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl = Get-ACL $directory
Set-ACL -Path $directory -ACLObject $acl

I hope this helps! Please let me know in regards to the folder inheritance or if you can perhaps see anything else that would cause the behaviour to be different between .NET Framework and .NET 5.0.

Kind Regards,

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.