Certificate is already installed on machine. Now I want to give read permission on PrivateKey of Certificate to application user.
相关问题
- How to Debug/Register a Permanent WMI Event Which
- Django check user group permissions
- How can I do variable substitution in a here-strin
- How to use a default value with parameter sets in
- Does powershell have a method_missing()?
相关文章
- 在vscode如何用code runner打开独立的控制台窗口,以及设置好调试模式时窗口的编码?
- C#调用PowerShell的问题
- EscapeDataString having differing behaviour betwee
- Flutter - http.get fails on macos build target: Co
- PowerShell Change owner of files and folders
- Does the apple push notification distribution cert
- Openssl telling certificate has expired when it ha
- OpenSSL error - unable to get local issuer certifi
Here is the Answer.
Created a powershell script file AddUserToCertificate.ps1
Here is the content for script file.
Now run it as part of deployment. Example to running above script in powershell console window.
this example give read permission to user testuser1 on certificate that in installed in \LocalMachine\My and has thumb print 1fb7603985a8a11d3e85abee194697e9784a253
If you are using ApplicationPoolIdentity then you username will be 'IIS AppPool\AppPoolNameHere'
Note: You will need to use ' ' as there is a space between IIS and AppPool.
The above answer did not work for me as the
$_.privatekey
returned null. I managed to get access to the private key and assign 'Read' permissions for my Application Pool as follows:You can use WinHttpCertCfg.exe, a Certificate Configuration Tool Link: https://docs.microsoft.com/en-us/windows/desktop/winhttp/winhttpcertcfg-exe--a-certificate-configuration-tool
Some code example:
As an alternate to above script. You can use PowerShell module. I have not tried it myself but module looks good. http://get-carbon.org/index.html
Here is command to set permissions http://get-carbon.org/Grant-Permission.html