I'm looking to manage certain settings of Azure via Azure Powershell from C#. I need to manage subscriptions for many many customers programmatically.
I want to ensure that anytime I open a PowerShell session to deal with particular customer's subscription, nothing of that session is left over in registry, certificate store, etc.
I have management certificates available to me as encrypted byte arrays. I can save them on the hard drive if needed.
I am also happy to call Powershell cmdlets not thru Powershell session but directly thru referencing objects in the .DLL
I would prefre to avoid the use of Management API directly in certain scenarios which is why I'd like to do so via Powershell
Is this possible? If so, how do I avoid using the certificate store? Ideally, I would prefer to just have a way to call into the cmdlet from C# without going thru Powershell session
$cert=New-Object System.Security.Cryptography.X509Certificates.X509Certificate2(byte array)? However you must have the certificate private key as well with you otherwise authentication would fail. Or in other words, you should ask your users to give you a PFX certificate with password instead of a CER file. - Gaurav MantriAzure PowerShell Cmdletsshortcut on your computer. You would need to do something similar i.e. programmatically launch PowerShell and load this module. Let me ping some PowerShell experts and they can provide much better solution for this. - Gaurav Mantri