Table of Contents

Class SubscriptionCollection

Namespace
Azure.ResourceManager.Resources
Assembly
Azure.ResourceManager.dll

A class representing a collection of SubscriptionResource and their operations. Each SubscriptionResource in the collection will belong to the same instance of TenantResource. To get a SubscriptionCollection instance call the GetSubscriptions method from an instance of TenantResource.

public class SubscriptionCollection : ArmCollection, IEnumerable<SubscriptionResource>, IEnumerable, IAsyncEnumerable<SubscriptionResource>
Inheritance
SubscriptionCollection
Implements
IAsyncEnumerable<SubscriptionResource>
Inherited Members

Constructors

SubscriptionCollection()

Initializes a new instance of the SubscriptionCollection class for mocking.

protected SubscriptionCollection()

Methods

Exists(string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/subscriptions/{subscriptionId}
  • Operation IdSubscriptions_Get
  • Default Api Version2022-12-01
  • ResourceSubscriptionResource
public virtual Response<bool> Exists(string subscriptionId, CancellationToken cancellationToken = default)

Parameters

subscriptionId string

The ID of the target subscription.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<bool>

Exceptions

ArgumentException

subscriptionId is an empty string, and was expected to be non-empty.

ArgumentNullException

subscriptionId is null.

ExistsAsync(string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/subscriptions/{subscriptionId}
  • Operation IdSubscriptions_Get
  • Default Api Version2022-12-01
  • ResourceSubscriptionResource
public virtual Task<Response<bool>> ExistsAsync(string subscriptionId, CancellationToken cancellationToken = default)

Parameters

subscriptionId string

The ID of the target subscription.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<bool>>

Exceptions

ArgumentException

subscriptionId is an empty string, and was expected to be non-empty.

ArgumentNullException

subscriptionId is null.

Get(string, CancellationToken)

Gets details about a specified subscription.

  • Request Path/subscriptions/{subscriptionId}
  • Operation IdSubscriptions_Get
  • Default Api Version2022-12-01
  • ResourceSubscriptionResource
public virtual Response<SubscriptionResource> Get(string subscriptionId, CancellationToken cancellationToken = default)

Parameters

subscriptionId string

The ID of the target subscription.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<SubscriptionResource>

Exceptions

ArgumentException

subscriptionId is an empty string, and was expected to be non-empty.

ArgumentNullException

subscriptionId is null.

GetAll(CancellationToken)

Gets all subscriptions for a tenant.

  • Request Path/subscriptions
  • Operation IdSubscriptions_List
  • Default Api Version2022-12-01
  • ResourceSubscriptionResource
public virtual Pageable<SubscriptionResource> GetAll(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token to use.

Returns

Pageable<SubscriptionResource>

A collection of SubscriptionResource that may take multiple service requests to iterate over.

GetAllAsync(CancellationToken)

Gets all subscriptions for a tenant.

  • Request Path/subscriptions
  • Operation IdSubscriptions_List
  • Default Api Version2022-12-01
  • ResourceSubscriptionResource
public virtual AsyncPageable<SubscriptionResource> GetAllAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token to use.

Returns

AsyncPageable<SubscriptionResource>

An async collection of SubscriptionResource that may take multiple service requests to iterate over.

GetAsync(string, CancellationToken)

Gets details about a specified subscription.

  • Request Path/subscriptions/{subscriptionId}
  • Operation IdSubscriptions_Get
  • Default Api Version2022-12-01
  • ResourceSubscriptionResource
public virtual Task<Response<SubscriptionResource>> GetAsync(string subscriptionId, CancellationToken cancellationToken = default)

Parameters

subscriptionId string

The ID of the target subscription.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<SubscriptionResource>>

Exceptions

ArgumentException

subscriptionId is an empty string, and was expected to be non-empty.

ArgumentNullException

subscriptionId is null.

GetIfExists(string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/subscriptions/{subscriptionId}
  • Operation IdSubscriptions_Get
  • Default Api Version2022-12-01
  • ResourceSubscriptionResource
public virtual NullableResponse<SubscriptionResource> GetIfExists(string subscriptionId, CancellationToken cancellationToken = default)

Parameters

subscriptionId string

The ID of the target subscription.

cancellationToken CancellationToken

The cancellation token to use.

Returns

NullableResponse<SubscriptionResource>

Exceptions

ArgumentException

subscriptionId is an empty string, and was expected to be non-empty.

ArgumentNullException

subscriptionId is null.

GetIfExistsAsync(string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/subscriptions/{subscriptionId}
  • Operation IdSubscriptions_Get
  • Default Api Version2022-12-01
  • ResourceSubscriptionResource
public virtual Task<NullableResponse<SubscriptionResource>> GetIfExistsAsync(string subscriptionId, CancellationToken cancellationToken = default)

Parameters

subscriptionId string

The ID of the target subscription.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<NullableResponse<SubscriptionResource>>

Exceptions

ArgumentException

subscriptionId is an empty string, and was expected to be non-empty.

ArgumentNullException

subscriptionId is null.