storage_accounts {AzureKeyVault} | R Documentation |
Storage accounts in Key Vault
Description
This class represents the collection of storage accounts managed by a vault. It provides methods for adding and removing accounts, and doing backups and restores. For operations with a specific account, see storage.
Methods
This class provides the following methods:
add(name, storage_account, key_name, regen_key=TRUE, regen_period=30, attributes=vault_object_attrs(), ...) get(name) remove(name, confirm=TRUE) list() backup(name) restore(backup)
Arguments
-
name
: A name by which to refer to the storage account. -
storage_account
: The Azure resource ID of the account. This can also be an object of classaz_resource
oraz_storage
, as provided by the AzureRMR or AzureStor packages respectively; in this case, the resource ID is obtained from the object. -
key_name
: The name of the storage access key that Key Vault will manage. -
regen_key
: Whether to automatically regenerate the access key at periodic intervals. -
regen_period
: How often to regenerate the access key. This can be a number, which will be interpreted as days; or as an ISO-8601 string denoting a duration, eg "P30D" (30 days). -
attributes
: Optional attributes for the secret. A convenient way to provide this is via the vault_object_attrs helper function. -
...
: Forcreate
andimport
, other named arguments which will be treated as tags. -
confirm
: Forremove
, whether to ask for confirmation before removing the account. -
backup
: Forrestore
, a string representing the backup blob for a key. -
email
: Forset_contacts
, the email addresses of the contacts.
Value
For get
and add
, an object of class stored_account
, representing the storage account itself.
For list
, a vector of account names.
For backup
, a string representing the backup blob for a storage account. If the account has multiple versions, the blob will contain all versions.
See Also
storage_account, vault_object_attrs
Azure Key Vault documentation, Azure Key Vault API reference
Examples
## Not run:
vault <- key_vault("mykeyvault")
# get the storage account details
library(AzureStor)
stor <- AzureRMR::get_azure_login()$
get_subscription("sub_id")$
get_resource_group("rgname")$
get_storage_account("mystorageacct")
vault$storage$create("mystor", stor, "key1")
vault$storage$list()
vault$storage$get("mystor")
# specifying a regeneration period of 6 months
vault$storage$create("mystor", regen_period="P6M")
# setting management tags
vault$storage$create("mystor", tag1="a value", othertag="another value")
# backup and restore an account
bak <- vault$storage$backup("mystor")
vault$storage$delete("mystor", confirm=FALSE)
vault$storage$restore(bak)
## End(Not run)