Beispiel #1
0
        public override void ExecuteCmdlet()
        {
            if (ShouldProcess(Name, Properties.Resources.CreateKeyVault))
            {
                if (VaultExistsInCurrentSubscription(Name, true))
                {
                    throw new ArgumentException(Resources.HsmAlreadyExists);
                }

                var vaultCreationParameter = new VaultCreationOrUpdateParameters()
                {
                    Name = this.Name,
                    ResourceGroupName = this.ResourceGroupName,
                    Location          = this.Location,
                    SkuName           = this.Sku,
                    TenantId          = GetTenantId(),
                    Tags          = this.Tag,
                    Administrator = this.Administrator,
                    SkuFamilyName = DefaultManagedHsmSkuFamily,
                    // If retention days is not specified, use the default value
                    SoftDeleteRetentionInDays = this.IsParameterBound(c => c.SoftDeleteRetentionInDays)
                            ? SoftDeleteRetentionInDays
                            : Constants.DefaultSoftDeleteRetentionDays,
                    // false is not accepted
                    EnablePurgeProtection = this.EnablePurgeProtection.IsPresent ? true : (bool?)null,
                    // use default network rule set
                    MhsmNetworkAcls     = new MHSMNetworkRuleSet(),
                    PublicNetworkAccess = this.PublicNetworkAccess
                };

                this.WriteObject(KeyVaultManagementClient.CreateNewManagedHsm(vaultCreationParameter, GraphClient));
            }
        }
Beispiel #2
0
        public override void ExecuteCmdlet()
        {
            if (ShouldProcess(Name, Properties.Resources.CreateKeyVault))
            {
                if (VaultExistsInCurrentSubscription(Name, true))
                {
                    throw new ArgumentException(Resources.HsmAlreadyExists);
                }

                var vaultCreationParameter = new VaultCreationOrUpdateParameters()
                {
                    Name = this.Name,
                    ResourceGroupName = this.ResourceGroupName,
                    Location          = this.Location,
                    SkuName           = this.Sku,
                    TenantId          = GetTenantId(),
                    Tags          = this.Tag,
                    Administrator = this.Administrator,
                    SkuFamilyName = DefaultManagedHsmSkuFamily
                };

                this.WriteObject(KeyVaultManagementClient.CreateNewManagedHsm(vaultCreationParameter, GraphClient));
            }
        }