I need to use bellow command in Azure Runbooks:
New-AzureRmDataFactoryLinkedService $MyDataFactoryObject -File "PATH/TO/JSON/STRING/FILE"
I am wondering to know is it possible to pass JSON Object itself instead of passing the file path?
I mean something like this:
$StorageLinkedService_JSON_str = '{
"name": "StorageName",
"properties": {
"type": "AzureStorage",
"description": "",
"typeProperties": {
"connectionString": "connectionString"
}
}
}'
$StorageLinkedService_Obj = ConvertFrom-Json -InputObject $StorageLinkedService_JSON_str
# I need to know is it possible to use one of these lines?
# New-AzureRmDataFactoryLinkedService $MyDataFactoryObject -File $StorageLinkedService_JSON_str
# OR This:
# New-AzureRmDataFactoryLinkedService $MyDataFactoryObject -File $StorageLinkedService_Obj
Depending on where the runbook is executed, a possibility might be to write your JSON data to a temporary file:
$jsonFilePath = 'C:\Windows\Temp\StorageLinkedService_JSON_str.json'
$StorageLinkedService_JSON_str |
Out-File -FilePath $jsonFilePath
New-AzureRmDataFactoryLinkedService $MyDataFactoryObject -File $jsonFilePath