I want to use Powershell to insert entities into Azure Table Storage and therefore need to instantiate a class which derives from the .NET abstract class Microsoft.WindowsAzure.StorageClient.TableServiceEntity
I am thinking to instantiate (in a Powershell 2.0 script) an object using eg New-Object and then adding members using Add-Member but cannot achieve the instantiation of a compatible TableServiceEntity derived class. (I can instantiate other arbitrary PSObjects, but they won’t do it seems)
Alternatively if someone could show me how to instantiate and populate ANY object class which could then be passed into the tableServiceContext.AddObject() method
What you can do is to create your class in a cs file and then reference it to your script.
Here’s example:
Save this as a cs file:
And here’s the code to run it:
You might need to pass your assembly to ReferencedAssemblies . And you also might need to upload assemblies into your script
The way to create table is described here:
Add or replace entity in Azure Table Storage