none
Unable to Register Azure File sync agent

    Întrebare

  • I am getting this error "The term 'Find-AzureRmResource' 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." while trying to perform File Sync Agent registration on windows 2016 server. I tried reinstallation  of the agent. Made sure I installed the right powershell version because in powershell 6.0.1, the above command is missing.

    Please help in fixing this.

    8 mai 2018 18:37

Toate mesajele

  • Find-AzureRmResource cmdlet is only available on below AzureRM Powershell versions. Try to install this AzureRm Powershell versions and let us know the result.

    8 mai 2018 19:56
    Moderator
  • I am also having this exact issue. Would you please be a little bit more specific about which version and how to get this resolved? Thank you!
    9 mai 2018 00:54
  • First run the following Powershell commands, and after try to download and install the Agent

    #Install the PowershellGet Module
    Install-Module -Name PowerShellGet -RequiredVersion 1.1.2.0 -Force 
    
    #Install the AzureRM Manager
    Install-Module -Name AzureRM -AllowClobber
    
    #Import the AzureRM Module
    Import-Module -Name AzureRM

    9 mai 2018 07:30
  • thank you very much for the quick response. I'm working on figuring out the following error, but in case you can assist 1st. I can't install because of the following warning

    WARNING: The version '1.1.7.2' of module 'PackageManagement' is currently in use. Retry the operation after closing the applications.

    9 mai 2018 12:56
  • I tried so many things, I'm not sure what solved it in the end. However, try -AllowClobber instead of -Force
    9 mai 2018 14:08
  • I'm experiencing the same problem when trying to register a server for Azure File Sync. I followed the MS deployment doc and the server meets the requirements (Server 2012R2, MGMT Framework 5.1, Azure Powershell 6.0). Tried reinstalling StorageSyncAgent.

    Anyone know how to fix this? Thanks!

    9 mai 2018 16:11
  • You have the wrong version of the client. Create a file sync object in azure and go to registered servers. There is a link to get the right version of the client. 

    It is available here. 

    https://go.microsoft.com/fwlink/?linkid=858257

    9 mai 2018 21:12
  • Thanks but that's where I downloaded it from. StorageSyncAgent_PreviewRefresh1_WS2012R2.msi

    • Editat de JStiggy 9 mai 2018 21:33
    9 mai 2018 21:33
  • I have the same problem, Version of AzureRM module 6.0.0 and 6.0.1 do not have the Find-* commands as these have been merged into Get-* commands , anyway I downgraded to 5.7.0 first which do have Find-* commands and the sync client keep giving me this error, downgraed to 4.3.1 which is the minimum requirement for the module and still to no avail.

    Anyone sovled this ?

    Thanks

    10 mai 2018 10:21
  • In the end I was able to solve the problem by doing the registration by powershell

    Get-AzureRmSubscription

    #Import Azure Storage Sync Module
    Import-Module "C:\Program Files\Azure\StorageSyncAgent\StorageSync.Management.PowerShell.Cmdlets.dll"

    #Login to Azure Storage Sync
    Login-AzureRmStorageSync -SubscriptionID "cfxxxxx-7axxx-4xxx-axxx-edxxxxxxxxx" -TenantID "91xxxxx-2xxx-4xxx-8xxx-a1xxxxxxxxx" -Credential $Cred

    Register-AzureRmStorageSyncServer -SubscriptionId "cfxxxxx-7axxx-4xxx-axxx-edxxxxxxxxx" -ResourceGroupName "Resourse Group" -StorageSyncService "FileSync Service Name"


    10 mai 2018 10:59
  • You can also uninstall AzureRM then Uninstall AzureRM.Resource then install AzureRM.Resource with -Requiredversion flag, then install azure rm with the requiredversion tag
    10 mai 2018 12:56
  • I tried powershell but getting the following error. Also ran the command without -StorageSyncService "FileSync Service Name" and was prompted for filesync service name but same error after entering the name of the filesync service. The file sync service is there but not sure what monitoring data path directory is referring to.

    Register-AzureRmStorageSyncServer : Monitoring data path directory doesn't exist.
    Error Type: 3
    At line:1 char:1
    + Register-AzureRmStorageSyncServer -SubscriptionId "6xxxxxxx-xxxx-xxxx ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Register-AzureRmStorageSyncServer], ServerRegistrationException
        + FullyQualifiedErrorId : Register-AzureRmStorageSyncServer,StorageSync.Management.PowerShell.Cmdlets.RegisterAzur


    10 mai 2018 20:06
  • Seeing this error while trying to import 

    PS C:\Users\shashank> Import-Module "C:\Program Files\Azure\StorageSyncAgent\StorageSync.Management.PowerShell.Cmdlets.dll"
    Import-Module : Could not load file or assembly 'file:///C:\Program 
    Files\Azure\StorageSyncAgent\StorageSync.Management.PowerShell.Cmdlets.dll' or one of its dependencies. An attempt 
    was made to load a program with an incorrect format.
    At line:1 char:1
    + Import-Module "C:\Program Files\Azure\StorageSyncAgent\StorageSync.Ma ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Import-Module], BadImageFormatException
        + FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.ImportModuleCommand

    11 mai 2018 10:14
  • A newer version of AzureRM broke server registration.  We are fixing this asap but in the interim, you can work around this problem via the following steps in PowerShell:

    1. Stop the current ServerRegistration.exe via taskmgr
    2. Bring up a PowerShell command prompt as Administrator
    3. PS C:> Uninstall-Module AzureRM
    4. PS C:> install-module -name AzureRM -RequiredVersion 5.7.0
    5. Start C:\Program Files\Azure\StorageSyncAgent\ServerRegistration.exe.

    This is documented at: https://docs.microsoft.com/en-us/azure/storage/files/storage-sync-files-troubleshoot#during-server-registration-get-the-error-the-term-find-azurermresource-is-not-recognized-as-the-name


    klaas [Principal PM Manager @Microsoft]

    11 mai 2018 16:21
  • @klaas, not working here FYI.. Win2016, tried with 2.011 and 2.3 agent.

    @Giuseppe, thanks for the hint!  I made a more reusable interactive script in case it helps someone else:

    Login-AzureRmAccount

    $azuresubscription = Get-AzureRmSubscription | Out-GridView -PassThru -Title "Select Subscription"
    Select-AzureRmSubscription -SubscriptionId $azuresubscription.SubscriptionID
    $filesyncservice = Find-AzureRmResource | ?{$_.ResourceType -eq "Microsoft.StorageSync/storageSyncServices"} | Out-GridView -PassThru -Title "Select FileSync Service"

    Login-AzureRmStorageSync -SubscriptionID $azuresubscription.SubscriptionID -TenantID $azuresubscription.TenantId
    Register-AzureRmStorageSyncServer -SubscriptionId $azuresubscription.SubscriptionID -ResourceGroupName $filesyncservice.ResourceGroupName -StorageSyncService $filesyncservice.Name

    16 mai 2018 20:33
  • Hi Eric, the agent update that fixes this is v2.3 so more information would be great.  If you installed the v2.3.1 version (https://www.microsoft.com/en-us/download/details.aspx?id=55988) this problem should not manifest.  Feel free to email me directly at klaasl at microsoft dot com or reply here.


    klaas [Principal PM Manager @Microsoft]

    16 mai 2018 21:21