Azure Runbook - Get-AzStorageFileHandle

Azure Runbook - Get-AzStorageFileHandle

我正在尝试使用 Azure 自动化 (Powershell / Runbook) 按计划清除文件锁定。 谁能指出我正确的方向?

我有

$StorageContextfmgappservicelogs = New-AzureStorageContext -StorageAccountName 'fmgappservicelogs' -StorageAccountKey $StorageAccountKey 
Get-AzStorageFileHandle -ShareName "fmgappservicelogs" -Context $StorageContextfmgappservicelogs
Close-AzStorageFileHandle -ShareName "fmgappservicelogs" -Context $StorageContextfmgappservicelogs  -CloseAll

我收到以下回复

Get-AzStorageFileHandle : The term 'Get-AzStorageFileHandle' is not recognized as the name of a cmdlet, function, 
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is 
correct and try again.

cmdlet Get-AzStorageFileHandle 在某些旧版本的 az.storage 模块中不可用。所以请确保您使用的是最新版本 az.storage module 2.6.0.

有一些方法可以安装最新版本的 az.storage 模块 2.6.0。

例如,导航到 azure 门户 -> 你的 azure 自动化帐户 -> 模块库 -> 在搜索框中,搜索“az.storage” -> 单击它,并在新页面中检查如果版本是最新版本 -> 然后单击“导入”按钮。以下是屏幕截图:

您还可以使用其他方式导入模块,按照此 article