Hi Yasar Shaikh,
thanks so much for posting that on the q&a, appreciate you taking the time to set out all the details.
even if u do have owner access at subscription level, the sync service could still throw out this error if the managed identity lacks proper permissions.
be sure that the managed identity of the storage sync service has "contributor" or "storage file data smb share contributor" role on the storage account that you're syncing to. owner rights sometimes don't propagate down correctly, so this is not uncommon. here's the ms doc on azure file sync roles: assign access permissions.
next, make sure the server's registration has not hung in a strange half-state. try running unregister-azstoragesyncserver in powershell (admin mode!!!) to clean out the remnants, then register again. often the previous registration haunts u even after you're convinced it's gone. further reading here: unregister server.
in addition to that, when u reinstalled the agent, please ensure u used the latest release from the microsoft download center. outdated agents will freak out with newer apis. download it fresh here: download azure file sync agent.
lastly if u've switched to a different storage account, check that the new one has network rules to accept traffic from the sync service. "unauthorized" errors are a favorite of misconfigs even if perms are set correctly. look at the "networking" tab of the storage account in the azure portal and see if it's not blocking u. Set up the network rules and virtual networks.
hope that helps! if you’re still stuck, send me the exact powershell error log (the -debug output is pure gold), and I’ll investigate deeper.
good luck ))
Alex
P.S. If my answer help to you, please Accept my answer
PPS That is my Answer and not a Comment
https://ctrlaltdel.blog/