Set-AzureStorageFileContent not setting last modified date
Cmdlet(s)
Set-AzureStorageFileContent -Force
PowerShell Version
Instructions: to get PowerShell version, type $PSVersionTable and look for the value associated with PSVersion
5.1.14393.693
Module Version
2.5.0
OS Version
Instructions: to get OS version, type $PSversionTable and look for value associated with BuildVersion
10.0.14393.693
Description
When running Set-AzureStorageFileContent -Force to overwrite a file in Azure File Storage, the last modified time of the file isn't changed when viewed over cifs from Azure Linux VMs.
Debug Output
Instructions: to get Debug Output, set $DebugPreference="Continue" and then execute the cmdlet or script causing the issue
cmdlet completes with no errors.
Script/Steps for Reproduction
Mount the share on an Azure Linux VM (I'm using Openlogic's CentOS 7.2):
mount -t cifs //tastagingftp.file.core.windows.net/stagingftproot /stagingftproottest -o vers=3.0,username=tastagingftp,password=<key>,noperm,cache=none
Check the last modified time of my test file:
[crupi@ta-chef1a ~]# ls -l /stagingftproottest/crupitest-ftp/
-rwxr-xr-x. 1 root root 495 Feb 15 19:39 test.txt
Modify the file so that it has new contents:
Set-AzureStorageFileContent -ShareName stagingftproot -Source C:\users\mcrupi\Downloads\test.txt -Path crupitest-ftp/test.txt -Context $ctx -Force
Check the last modified time of my test file via Storage Explorer (http://storageexplorer.com/) which correctly shows:
LastModified Wed, 15 Feb 2017 19:52:14 GMT
Check the last modified time of my test file again from my Linux VM (it hasn't changed):
[crupi@ta-chef1a ~]# ls -l /stagingftproottest/crupitest-ftp/
-rwxr-xr-x. 1 root root 495 Feb 15 19:39 test.txt
The lastmodified time on Linux now shows about 13 minutes behind what it should.
Other methods of modifying this file in-place, for example, using Storage Explorer to upload and overwrite, do not have this issue, so it seems this has to be related to how the cmdlet overwrites the file.
I would, second the reported behavior.
stat test2
Modify: 2017-02-19 03:21:35.460242600 +0000
Set-AzureStorageFileContent -ShareName test -Source C:\users\rakesh\mongodeploy.json -Path test2 -Context $ctx -Force
After modifying the file, modify time remains the same
Modify: 2017-02-19 03:21:35.460242600 +0000
We can repro the same issue on our side. But it's strange the issue only happen when file uploaded by PowerShell: the Last Modify time change on server, but not on mounted share on Linux. I will contact XSMB team to see if they have any thought why this happen.
As I get from File feature team, this is by design. There are 2 properties of a File:
- LastWriteTime is the property that will be shown in file system (e.g. ls -l in linux)
- LastModificationTime is the properties can be can show with rest
REST Write (PowerShell run through rest) currently does not update LastWriteTime. All write operations (rest or XSMB) change the ETag and LastModificationTime .
@cormacpayne Would you please help to close this issue, as it's not PowerShell issue, but by design behavior of server. Thanks!