diff --git a/src/Aks/Aks/ChangeLog.md b/src/Aks/Aks/ChangeLog.md index 92f3128086ee..5674a8e6d002 100644 --- a/src/Aks/Aks/ChangeLog.md +++ b/src/Aks/Aks/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Fixed the issue that Invoke-AzAksRunCommand will fail when the directory for parameter CommandContextAttachment contains sub-directories. [#20734] * Added parameter `-AadProfile` for `New-AzAksCluster` and `Set-AzAksCluster` * Added parameter `-NodeHostGroupID` for `New-AzAksCluster` and parameter `-HostGroupID` for `New-AzAksNodePool` diff --git a/src/Aks/Aks/Commands/RunAzureRmAksCommand.cs b/src/Aks/Aks/Commands/RunAzureRmAksCommand.cs index 9e0854099df7..c7a663faffc6 100644 --- a/src/Aks/Aks/Commands/RunAzureRmAksCommand.cs +++ b/src/Aks/Aks/Commands/RunAzureRmAksCommand.cs @@ -154,7 +154,7 @@ private string GetCommandContext() { foreach (string filepath in filesToAttach) { - var relativePath = filepath.Replace(rootDirectory, "").Trim('/').Trim('\\'); + var relativePath = filepath.Replace(rootDirectory, "").Replace('\\', '/').Trim('/'); var memoryZipFile = archive.CreateEntry(relativePath); var fileContent = File.ReadAllText(filepath); using (var entryStream = memoryZipFile.Open())