|
| 1 | +--- |
| 2 | +external help file: Microsoft.Azure.PowerShell.Cmdlets.Storage.dll-Help.xml |
| 3 | +Module Name: Az.Storage |
| 4 | +online version: https://learn.microsoft.com/powershell/module/az.storage/get-azstoragefilesymboliclink |
| 5 | +schema: 2.0.0 |
| 6 | +--- |
| 7 | + |
| 8 | +# Get-AzStorageFileSymbolicLink |
| 9 | + |
| 10 | +## SYNOPSIS |
| 11 | +Gets the properties of a symbolic link. Only works in NFS file share. |
| 12 | + |
| 13 | +## SYNTAX |
| 14 | + |
| 15 | +### ShareName (Default) |
| 16 | +``` |
| 17 | +Get-AzStorageFileSymbolicLink [-ShareName] <String> [-Path] <String> [-Context <IStorageContext>] |
| 18 | + [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>] |
| 19 | + [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [<CommonParameters>] |
| 20 | +``` |
| 21 | + |
| 22 | +### Share |
| 23 | +``` |
| 24 | +Get-AzStorageFileSymbolicLink [-ShareClient] <ShareClient> [-Path] <String> [-Context <IStorageContext>] |
| 25 | + [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>] |
| 26 | + [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [<CommonParameters>] |
| 27 | +``` |
| 28 | + |
| 29 | +### Directory |
| 30 | +``` |
| 31 | +Get-AzStorageFileSymbolicLink [-ShareDirectoryClient] <ShareDirectoryClient> [-Path] <String> |
| 32 | + [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>] |
| 33 | + [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [<CommonParameters>] |
| 34 | +``` |
| 35 | + |
| 36 | +## DESCRIPTION |
| 37 | +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. |
| 38 | + |
| 39 | +## EXAMPLES |
| 40 | + |
| 41 | +### Example 1: Get symbolic link properties using share name |
| 42 | +```powershell |
| 43 | +$ctx = New-AzStorageContext -StorageAccountName "myaccount" -EnableFileBackupRequestIntent |
| 44 | +$link = Get-AzStorageFileSymbolicLink -ShareName "nfsshare" -Path "linkdir/mylink" -Context $ctx |
| 45 | +$link |
| 46 | +$link.FileProperties |
| 47 | +$link.FileProperties.PosixProperties |
| 48 | +$link.ShareFileSymbolicLinkInfo |
| 49 | +``` |
| 50 | + |
| 51 | +```output |
| 52 | +AccountName: myaccount, ShareName: nfsshare |
| 53 | +
|
| 54 | +Type Length Name Path |
| 55 | +---- ------ ---- ---- |
| 56 | +File 0 mylink linkdir/mylink |
| 57 | +
|
| 58 | +LastModified : 9/17/2025 8:36:43 AM +00:00 |
| 59 | +Metadata : {} |
| 60 | +ContentLength : 13 |
| 61 | +ContentType : application/octet-stream |
| 62 | +ETag : "0x8DDF5C554DCC708" |
| 63 | +ContentHash : |
| 64 | +ContentEncoding : |
| 65 | +CacheControl : |
| 66 | +ContentDisposition : |
| 67 | +ContentLanguage : |
| 68 | +CopyCompletedOn : 1/1/0001 12:00:00 AM +00:00 |
| 69 | +CopyStatusDescription : |
| 70 | +CopyId : |
| 71 | +CopyProgress : |
| 72 | +CopySource : |
| 73 | +CopyStatus : Pending |
| 74 | +IsServerEncrypted : True |
| 75 | +SmbProperties : Azure.Storage.Files.Shares.Models.FileSmbProperties |
| 76 | +LeaseDuration : Infinite |
| 77 | +LeaseState : Available |
| 78 | +LeaseStatus : Unlocked |
| 79 | +PosixProperties : Azure.Storage.Files.Shares.Models.FilePosixProperties |
| 80 | +
|
| 81 | +
|
| 82 | +FileMode : rwxrwxrwx |
| 83 | +Owner : 0 |
| 84 | +Group : 0 |
| 85 | +FileType : SymLink |
| 86 | +LinkCount : 1 |
| 87 | +
|
| 88 | +
|
| 89 | +ETag : "0x8DDF5C554DCC708" |
| 90 | +LastModified : 9/17/2025 8:36:43 AM +00:00 |
| 91 | +LinkText : app%2Fmain.exe |
| 92 | +``` |
| 93 | + |
| 94 | +This command gets the properties of a symbolic link named "mylink" in the "links" directory of the NFS file share "nfsshare". |
| 95 | + |
| 96 | +### Example 2: Get multiple symbolic links in a directory |
| 97 | +```powershell |
| 98 | +$files = Get-AzStorageFile -ShareName "nfsshare" -Path "linkdir" -Context $ctx | Get-AzStorageFile -ExcludeExtendedInfo |
| 99 | +$symLinkFiles = $files | ? {$_.FileProperties.PosixProperties.FileType -eq "SymLink"} |
| 100 | +foreach ($file in $symLinkFiles) { |
| 101 | + $symlink = Get-AzStorageFileSymbolicLink -ShareName "nfsshare" -Path "linkdir/$($file.Name)" -Context $ctx |
| 102 | + Write-Output "$($file.Name) -> $([System.Web.HttpUtility]::UrlDecode($symlink.ShareFileSymbolicLinkInfo.LinkText))" |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +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. |
| 107 | + |
| 108 | +### Example 3: Get symbolic link using ShareClient pipeline |
| 109 | +```powershell |
| 110 | +$ctx = New-AzStorageContext -StorageAccountName "myaccount" -EnableFileBackupRequestIntent |
| 111 | +$shareClient = Get-AzStorageShare -Name "nfsshare" -Context $ctx |
| 112 | +$link = $shareClient | Get-AzStorageFileSymbolicLink -Path "linkdir/mylink" |
| 113 | +``` |
| 114 | + |
| 115 | +This command gets a symbolic link using a ShareClient object obtained from Get-AzStorageShare, demonstrating the pipeline usage with the Share parameter set. |
| 116 | + |
| 117 | +### Example 4: Get symbolic link using ShareDirectoryClient pipeline |
| 118 | +```powershell |
| 119 | +$ctx = New-AzStorageContext -StorageAccountName "myaccount" -EnableFileBackupRequestIntent |
| 120 | +$dirClient = Get-AzStorageFile -ShareName "nfsshare" -Path "linkdir" -Context $ctx |
| 121 | +$link = $dirClient | Get-AzStorageFileSymbolicLink -Path "mylink" |
| 122 | +``` |
| 123 | + |
| 124 | +This command gets a symbolic link within a specific directory using a ShareDirectoryClient object, demonstrating the pipeline usage with the Directory parameter set. |
| 125 | + |
| 126 | +## PARAMETERS |
| 127 | + |
| 128 | +### -ClientTimeoutPerRequest |
| 129 | +The client side maximum execution time for each request in seconds. |
| 130 | + |
| 131 | +```yaml |
| 132 | +Type: System.Nullable`1[System.Int32] |
| 133 | +Parameter Sets: (All) |
| 134 | +Aliases: ClientTimeoutPerRequestInSeconds |
| 135 | + |
| 136 | +Required: False |
| 137 | +Position: Named |
| 138 | +Default value: None |
| 139 | +Accept pipeline input: False |
| 140 | +Accept wildcard characters: False |
| 141 | +``` |
| 142 | +
|
| 143 | +### -ConcurrentTaskCount |
| 144 | +The total amount of concurrent async tasks. |
| 145 | +The default value is 10. |
| 146 | +
|
| 147 | +```yaml |
| 148 | +Type: System.Nullable`1[System.Int32] |
| 149 | +Parameter Sets: (All) |
| 150 | +Aliases: |
| 151 | + |
| 152 | +Required: False |
| 153 | +Position: Named |
| 154 | +Default value: None |
| 155 | +Accept pipeline input: False |
| 156 | +Accept wildcard characters: False |
| 157 | +``` |
| 158 | +
|
| 159 | +### -Context |
| 160 | +Azure Storage Context Object |
| 161 | +
|
| 162 | +```yaml |
| 163 | +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext |
| 164 | +Parameter Sets: (All) |
| 165 | +Aliases: |
| 166 | + |
| 167 | +Required: False |
| 168 | +Position: Named |
| 169 | +Default value: None |
| 170 | +Accept pipeline input: True (ByPropertyName, ByValue) |
| 171 | +Accept wildcard characters: False |
| 172 | +``` |
| 173 | +
|
| 174 | +### -DefaultProfile |
| 175 | +The credentials, account, tenant, and subscription used for communication with Azure. |
| 176 | +
|
| 177 | +```yaml |
| 178 | +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer |
| 179 | +Parameter Sets: (All) |
| 180 | +Aliases: AzureRmContext, AzureCredential |
| 181 | + |
| 182 | +Required: False |
| 183 | +Position: Named |
| 184 | +Default value: None |
| 185 | +Accept pipeline input: False |
| 186 | +Accept wildcard characters: False |
| 187 | +``` |
| 188 | +
|
| 189 | +### -Path |
| 190 | +Path of the symbolic link file to retrieve. |
| 191 | +
|
| 192 | +```yaml |
| 193 | +Type: System.String |
| 194 | +Parameter Sets: (All) |
| 195 | +Aliases: |
| 196 | + |
| 197 | +Required: True |
| 198 | +Position: 1 |
| 199 | +Default value: None |
| 200 | +Accept pipeline input: True (ByPropertyName, ByValue) |
| 201 | +Accept wildcard characters: False |
| 202 | +``` |
| 203 | +
|
| 204 | +### -ServerTimeoutPerRequest |
| 205 | +The server time out for each request in seconds. |
| 206 | +
|
| 207 | +```yaml |
| 208 | +Type: System.Nullable`1[System.Int32] |
| 209 | +Parameter Sets: (All) |
| 210 | +Aliases: ServerTimeoutPerRequestInSeconds |
| 211 | + |
| 212 | +Required: False |
| 213 | +Position: Named |
| 214 | +Default value: None |
| 215 | +Accept pipeline input: False |
| 216 | +Accept wildcard characters: False |
| 217 | +``` |
| 218 | +
|
| 219 | +### -ShareClient |
| 220 | +ShareClient object indicating the share containing the symbolic link. |
| 221 | +
|
| 222 | +```yaml |
| 223 | +Type: Azure.Storage.Files.Shares.ShareClient |
| 224 | +Parameter Sets: Share |
| 225 | +Aliases: |
| 226 | + |
| 227 | +Required: True |
| 228 | +Position: 0 |
| 229 | +Default value: None |
| 230 | +Accept pipeline input: True (ByPropertyName, ByValue) |
| 231 | +Accept wildcard characters: False |
| 232 | +``` |
| 233 | +
|
| 234 | +### -ShareDirectoryClient |
| 235 | +ShareDirectoryClient object indicating the base folder containing the symbolic link. |
| 236 | +
|
| 237 | +```yaml |
| 238 | +Type: Azure.Storage.Files.Shares.ShareDirectoryClient |
| 239 | +Parameter Sets: Directory |
| 240 | +Aliases: |
| 241 | + |
| 242 | +Required: True |
| 243 | +Position: 0 |
| 244 | +Default value: None |
| 245 | +Accept pipeline input: True (ByPropertyName, ByValue) |
| 246 | +Accept wildcard characters: False |
| 247 | +``` |
| 248 | +
|
| 249 | +### -ShareName |
| 250 | +Name of the file share containing the symbolic link. |
| 251 | +
|
| 252 | +```yaml |
| 253 | +Type: System.String |
| 254 | +Parameter Sets: ShareName |
| 255 | +Aliases: |
| 256 | + |
| 257 | +Required: True |
| 258 | +Position: 0 |
| 259 | +Default value: None |
| 260 | +Accept pipeline input: False |
| 261 | +Accept wildcard characters: False |
| 262 | +``` |
| 263 | +
|
| 264 | +### CommonParameters |
| 265 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). |
| 266 | +
|
| 267 | +## INPUTS |
| 268 | +
|
| 269 | +### Azure.Storage.Files.Shares.ShareClient |
| 270 | +
|
| 271 | +### Azure.Storage.Files.Shares.ShareDirectoryClient |
| 272 | +
|
| 273 | +### System.String |
| 274 | +
|
| 275 | +### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext |
| 276 | +
|
| 277 | +## OUTPUTS |
| 278 | +
|
| 279 | +### Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile |
| 280 | +
|
| 281 | +## NOTES |
| 282 | +- This cmdlet only works with NFS file shares |
| 283 | +- The returned object contains the symbolic link properties including the target path (LinkText) |
| 284 | +- Use the FileProperties.LinkText property to access the target path of the symbolic link |
| 285 | +- The FileProperties.IsSymbolicLink property can be used to verify the file is indeed a symbolic link |
| 286 | +
|
| 287 | +## RELATED LINKS |
| 288 | +
|
| 289 | +[New-AzStorageFileSymbolicLink](./New-AzStorageFileSymbolicLink.md) |
| 290 | +
|
| 291 | +[Get-AzStorageFile](./Get-AzStorageFile.md) |
| 292 | +
|
| 293 | +[New-AzStorageFileHardLink](./New-AzStorageFileHardLink.md) |
0 commit comments