if (FALSE) {
gr <- get_graph_login()
app <- gr$create_app("MyNewApp")
# password resetting: remove the old password, add a new one
pwd_id <- app$properties$passwordCredentials[[1]]$keyId
app$add_password()
app$remove_password(pwd_id)
# set a redirect URI
app$update(publicClient=list(redirectUris=I("http://localhost:1410")))
# add API permission (access Azure Storage as user)
app$update(requiredResourceAccess=list(
list(
resourceAppId="e406a681-f3d4-42a8-90b6-c2b029497af1",
resourceAccess=list(
list(
id="03e0da56-190b-40ad-a80c-ea378c433f7f",
type="Scope"
)
)
)
))
# add a certificate from a .pem file
app$add_certificate("cert.pem")
# can also read the file into an openssl object, and then add the cert
cert <- openssl::read_cert("cert.pem")
app$add_certificate(cert)
# add a certificate stored in Azure Key Vault
vault <- AzureKeyVault::key_vault("mytenant")
cert2 <- vault$certificates$get("certname")
app$add_certificate(cert2)
# change the app name
app$update(displayName="MyRenamedApp")
}
Run the code above in your browser using DataLab