How to import a module in a Azure PowerShell Function?

不羁岁月 提交于 2021-02-05 11:55:37

问题


Im trying to query an azure table from a function ( using Get-AzTableRow ) . Works very well from my laptop but the module "aztable' is not present in the azure function, and therefore all i get is a red screen :( Is there a way to install it ?

Thanks ! David


回答1:


You do not need to install the AzTable module in the Azure Function yourself. When you run the command, it will install the corresponding module for you.

Here are the screenshots:

The example of the AzTable module:

$location = "eastus"
$resourceGroup = "charlesTable11"
New-AzResourceGroup -ResourceGroupName $resourceGroup -Location $location
$storageAccountName = "pshtablestorage1122"
$storageAccount = New-AzStorageAccount -ResourceGroupName $resourceGroup `
  -Name $storageAccountName `
  -Location $location `
  -SkuName Standard_LRS `
  -Kind Storage

$ctx = $storageAccount.Context
$tableName = "pshtesttable"
New-AzStorageTable –Name $tableName –Context $ctx
Get-AzStorageTable –Context $ctx | select Name




回答2:


Azure PowerShell is installed or updated, you must install module AzTable, which has the commands for managing the entities. To install this module, run PowerShell as an administrator and use the Install-Module command. You may refer to the suggestion mentioned in this article. https://docs.microsoft.com/en-us/azure/storage/tables/table-storage-how-to-use-powershell

Please see https://docs.microsoft.com/en-us/azure/azure-functions/supported-languages

AzTable module:Supported languages in Azure Functions powershellgallery.com/packages/AzTable/2.0.1

Kindly let us know if the above helps or you need further assistance on this issue.



来源:https://stackoverflow.com/questions/56868104/how-to-import-a-module-in-a-azure-powershell-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!