Edit

Share via


Get-AzStorageFileSymbolicLink

Gets the properties of a symbolic link. Only works in NFS file share.

Syntax

ShareName (Default)

Get-AzStorageFileSymbolicLink
    [-ShareName] <String>
    [-Path] <String>
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <IAzureContextContainer>]
    [-ConcurrentTaskCount <Int32>]
    [<CommonParameters>]

Share

Get-AzStorageFileSymbolicLink
    [-ShareClient] <ShareClient>
    [-Path] <String>
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <IAzureContextContainer>]
    [-ConcurrentTaskCount <Int32>]
    [<CommonParameters>]

Directory

Get-AzStorageFileSymbolicLink
    [-ShareDirectoryClient] <ShareDirectoryClient>
    [-Path] <String>
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <IAzureContextContainer>]
    [-ConcurrentTaskCount <Int32>]
    [<CommonParameters>]

Description

The Get-AzStorageFileSymbolicLink cmdlet retrieves the properties and target path of a symbolic link in an Azure File share. This cmdlet only works with NFS file shares.

Examples

$ctx = New-AzStorageContext -StorageAccountName "myaccount" -EnableFileBackupRequestIntent
$link = Get-AzStorageFileSymbolicLink -ShareName "nfsshare" -Path "linkdir/mylink" -Context $ctx
$link
$link.FileProperties
$link.FileProperties.PosixProperties
$link.ShareFileSymbolicLinkInfo
AccountName: myaccount, ShareName: nfsshare

Type Length Name   Path
---- ------ ----   ----
File      0 mylink linkdir/mylink

LastModified          : 9/17/2025 8:36:43 AM +00:00
Metadata              : {}
ContentLength         : 13
ContentType           : application/octet-stream
ETag                  : "0x8DDF5C554DCC708"
ContentHash           :
ContentEncoding       :
CacheControl          :
ContentDisposition    :
ContentLanguage       :
CopyCompletedOn       : 1/1/0001 12:00:00 AM +00:00
CopyStatusDescription :
CopyId                :
CopyProgress          :
CopySource            :
CopyStatus            : Pending
IsServerEncrypted     : True
SmbProperties         : Azure.Storage.Files.Shares.Models.FileSmbProperties
LeaseDuration         : Infinite
LeaseState            : Available
LeaseStatus           : Unlocked
PosixProperties       : Azure.Storage.Files.Shares.Models.FilePosixProperties


FileMode  : rwxrwxrwx
Owner     : 0
Group     : 0
FileType  : SymLink
LinkCount : 1


ETag         : "0x8DDF5C554DCC708"
LastModified : 9/17/2025 8:36:43 AM +00:00
LinkText     : app%2Fmain.exe

This command gets the properties of a symbolic link named "mylink" in the "links" directory of the NFS file share "nfsshare".

$files = Get-AzStorageFile -ShareName "nfsshare" -Path "linkdir" -Context $ctx | Get-AzStorageFile -ExcludeExtendedInfo
$symLinkFiles = $files | Where-Object {$_.FileProperties.PosixProperties.FileType.ToString() -eq "SymLink"}
foreach ($file in $symLinkFiles) {
    $symlink = Get-AzStorageFileSymbolicLink -ShareName "nfsshare"  -Path "linkdir/$($file.Name)" -Context $ctx
    Write-Output "$($file.Name) -> $([System.Web.HttpUtility]::UrlDecode($symlink.ShareFileSymbolicLinkInfo.LinkText))"
}

This command first lists all files in "linkdir" directory , then filter out all files which are symbolic link, finally gets symbolic link properties for each file.

$ctx = New-AzStorageContext -StorageAccountName "myaccount" -EnableFileBackupRequestIntent
$shareClient = Get-AzStorageShare -Name "nfsshare" -Context $ctx
$link = $shareClient | Get-AzStorageFileSymbolicLink -Path "linkdir/mylink"

This command gets a symbolic link using a ShareClient object obtained from Get-AzStorageShare, demonstrating the pipeline usage with the Share parameter set.

$ctx = New-AzStorageContext -StorageAccountName "myaccount" -EnableFileBackupRequestIntent
$dirClient = Get-AzStorageFile -ShareName "nfsshare" -Path "linkdir" -Context $ctx
$link = $dirClient | Get-AzStorageFileSymbolicLink -Path "mylink"

This command gets a symbolic link within a specific directory using a ShareDirectoryClient object, demonstrating the pipeline usage with the Directory parameter set.

Parameters

-ClientTimeoutPerRequest

The client side maximum execution time for each request in seconds.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:ClientTimeoutPerRequestInSeconds

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ConcurrentTaskCount

The total amount of concurrent async tasks. The default value is 10.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Context

Azure Storage Context Object

Parameter properties

Type:IStorageContext
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Path

Path of the symbolic link file to retrieve.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-ServerTimeoutPerRequest

The server time out for each request in seconds.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:ServerTimeoutPerRequestInSeconds

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ShareClient

ShareClient object indicating the share containing the symbolic link.

Parameter properties

Type:ShareClient
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Share
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-ShareDirectoryClient

ShareDirectoryClient object indicating the base folder containing the symbolic link.

Parameter properties

Type:ShareDirectoryClient
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Directory
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-ShareName

Name of the file share containing the symbolic link.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ShareName
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

ShareClient

ShareDirectoryClient

String

IStorageContext

Outputs

AzureStorageFile

Notes

  • This cmdlet only works with NFS file shares
  • The returned object contains the symbolic link properties including the target path (LinkText)
  • Use the FileProperties.LinkText property to access the target path of the symbolic link
  • The FileProperties.IsSymbolicLink property can be used to verify the file is indeed a symbolic link