public async Task QuickstartCerts() { CancellationToken token = this.cts.Token; await this.runtime.DeployConfigurationAsync(token); string leafDeviceId = $"{Context.Current.DeviceId}-quickstart-certs"; var leaf = await LeafDevice.CreateAsync( leafDeviceId, Protocol.Amqp, AuthenticationType.Sas, Option.None <string>(), false, CertificateAuthority.GetQuickstart(), this.iotHub, token); await TryFinally.DoAsync( async() => { DateTime seekTime = DateTime.Now; await leaf.SendEventAsync(token); await leaf.WaitForEventsReceivedAsync(seekTime, token); await leaf.InvokeDirectMethodAsync(token); }, async() => { await leaf.DeleteIdentityAsync(token); }); }
public async Task X509ManualProvision() { CancellationToken token = this.TestToken; await this.runtime.DeployConfigurationAsync(token); string leafDeviceId = DeviceId.Current.Generate(); var leaf = await LeafDevice.CreateAsync( leafDeviceId, Protocol.Amqp, AuthenticationType.Sas, Option.Some(this.runtime.DeviceId), false, CertificateAuthority.GetQuickstart(), this.iotHub, token, Option.None <string>()); await TryFinally.DoAsync( async() => { DateTime seekTime = DateTime.Now; await leaf.SendEventAsync(token); await leaf.WaitForEventsReceivedAsync(seekTime, token); await leaf.InvokeDirectMethodAsync(token); }, async() => { await leaf.DeleteIdentityAsync(token); }); }