问题描述
我正在尝试使用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
在z.storage模块的某些旧版本中不可用。因此,请确保您使用的是最新版本az.storage module 2.6.0
。
有一些方法可以安装最新版本的az.storage模块2.6.0。
例如,导航到azure门户->您的azure自动化帐户->模块库->在搜索框中,搜索“ az.storage”->单击它,然后在新页面中检查版本是否为最新的->然后单击“导入”按钮。这是屏幕截图:
您还可以按照此article使用其他方法导入模块。