【问题标题】:Create Easy Tables with Power script使用 Power 脚本创建简易表格
【发布时间】:2018-04-13 06:39:18
【问题描述】:

有没有办法通过PowerShell而不是JS文件来定义Easy Tables?

任何通过 CSV 创建简单表的示例或有关通过 JS 文件定义的文档都会有所帮助。

【问题讨论】:

  • 我正在尝试从 Portal 添加一个简易表。但由于表具有复杂的关系,我需要一种通过命令行左右创建它们的编程方式。
  • 那么到目前为止,您尝试过什么?什么是“简易餐桌”?在 Azure 门户中搜索“easy”不会返回任何结果。

标签: powershell azure azure-sql-database azure-mobile-services offline


【解决方案1】:

我们可以使用 Rest API 创建 Easy 表并将数据导入到 Easy 表中。我用 Postman 测试它。

创建简易表格

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/tomtestmobile/extensions/Microsoft.Mobile.Management/tables?api-version=2014-11-01

身体样本:

{"name":"tableName","permissions":[{"name":"read","level":"anonymous"},{"name":"insert","level":"anonymous"},{"name":"update","level":"anonymous"},{"name":"delete","level":"anonymous"},{"name":"undelete","level":"anonymous"}],"links":[],"insert":"","update":"","delete":"","read":"","undelete":"","hasCustomPermissions":false,"extendedSettings":{"softDelete":true},"columns":[{"name":"Team","type":"String"},{"name":"Product","type":"String"},{"name":" name","type":"String"}]}

导入数据

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/tomtestmobile/extensions/Microsoft.Mobile.Management/tables/JustForTest3/data?api-version=2014-11-01

身体样本:

{"csvData":"Team,Cover Product, name\r\nCloud,Azure ,tom"}

请在 Powershell 中使用以下代码调用 rest API。如何获得授权,可以参考这个video

  $body = "jsonstring"
  $hdrs = @{}
  $hdrs.Add("Authorization","Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1d...")
  Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType 'application/json' -Headers $hdrs

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-06
    • 2021-06-20
    • 1970-01-01
    • 2015-12-30
    • 2016-12-12
    • 2014-05-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多