public async Task <PublicIPAddressInner> CreatePublicIPAddressAsync( IResourceGroup resourceGroup, string publicIPAddressName, string domainNameLabel, IDictionary <string, string> tags = null, CancellationToken cancellationToken = default ) { tags = tags ?? new Dictionary <string, string>(); // Define Public IP var publicIPAddressDefinition = new PublicIPAddressInner { Location = resourceGroup.RegionName, Tags = tags, PublicIPAllocationMethod = IPAllocationMethod.Dynamic, DnsSettings = new PublicIPAddressDnsSettings { DomainNameLabel = domainNameLabel }, IdleTimeoutInMinutes = 4 }; publicIPAddressDefinition.Validate(); var publicIPAddress = await _networkManagementClient .PublicIPAddresses .CreateOrUpdateAsync( resourceGroup.Name, publicIPAddressName, publicIPAddressDefinition, cancellationToken ); return(publicIPAddress); }
/// <summary> /// Creates or updates a static or dynamic public IP address. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='publicIpAddressName'> /// The name of the public IP address. /// </param> /// <param name='parameters'> /// Parameters supplied to the create or update public IP address operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <PublicIPAddressInner> CreateOrUpdateAsync(this IPublicIPAddressesOperations operations, string resourceGroupName, string publicIpAddressName, PublicIPAddressInner parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, publicIpAddressName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }