|
24 | 24 | using System.Threading.Tasks;
|
25 | 25 | using Microsoft.Azure.PowerShell.Cmdlets.Blueprint.Properties;
|
26 | 26 | using BlueprintManagement = Microsoft.Azure.Management.Blueprint;
|
| 27 | +using Microsoft.Rest.Azure; |
27 | 28 |
|
28 | 29 | namespace Microsoft.Azure.Commands.Blueprint.Common
|
29 | 30 | {
|
@@ -273,12 +274,29 @@ public PSArtifact GetArtifact(string scope, string blueprintName, string artifac
|
273 | 274 | public IEnumerable<PSArtifact> ListArtifacts(string scope, string blueprintName, string version)
|
274 | 275 | {
|
275 | 276 | var list = new List<PSArtifact>();
|
| 277 | + var artifactList = new List<Artifact>(); |
276 | 278 |
|
277 |
| - var artifacts = string.IsNullOrEmpty(version) |
278 |
| - ? blueprintManagementClient.Artifacts.List(scope, blueprintName) |
279 |
| - : blueprintManagementClient.PublishedArtifacts.List(scope, blueprintName, version); |
| 279 | + if (string.IsNullOrEmpty(version)) |
| 280 | + { |
| 281 | + var artifacts = blueprintManagementClient.Artifacts.List(scope, blueprintName); |
| 282 | + artifactList.AddRange(artifacts.AsEnumerable()); |
| 283 | + while (!string.IsNullOrEmpty(artifacts.NextPageLink)) |
| 284 | + { |
| 285 | + artifacts = blueprintManagementClient.Artifacts.ListNext(artifacts.NextPageLink); |
| 286 | + artifactList.AddRange(artifacts.AsEnumerable()); |
| 287 | + } |
| 288 | + } else |
| 289 | + { |
| 290 | + var artifacts = blueprintManagementClient.PublishedArtifacts.List(scope, blueprintName, version); |
| 291 | + artifactList.AddRange(artifacts.AsEnumerable()); |
| 292 | + while (!string.IsNullOrEmpty(artifacts.NextPageLink)) |
| 293 | + { |
| 294 | + artifacts = blueprintManagementClient.PublishedArtifacts.ListNext(artifacts.NextPageLink); |
| 295 | + artifactList.AddRange(artifacts.AsEnumerable()); |
| 296 | + } |
| 297 | + } |
280 | 298 |
|
281 |
| - foreach (var artifact in artifacts) |
| 299 | + foreach (var artifact in artifactList) |
282 | 300 | {
|
283 | 301 | switch (artifact)
|
284 | 302 | {
|
|
0 commit comments