Skip to main content

Azure setup scripts

Some features of EasyLife 365 keep data in a resource in your own Azure subscription. You create the resource and give access yourself, with the scripts on this page. EasyLife 365 Admin Insiders fills in the command for you, and you can read every script before you run it.

How the scripts work​

  • You run them, in your subscription. EasyLife 365 never creates anything in your subscription and never assigns a role there.
  • Parameters only. A script takes the names, the region and the application (client) ID of the product's app as parameters, and reads nothing else.
  • Safe to run again. A second run changes nothing: it lists what exists already as skipped. A script never changes the settings of an existing resource and never deletes anything.
  • Versioned. Each use case has a version folder, such as v1. A published version never changes. A fix comes as a new version, and the older one stays.
  • Two ways to run each script: PowerShell (.ps1, with the Az modules) or Bash with the Azure CLI (.sh). Azure Cloud Shell has both.
  • The product's app is shown by name before any change, with its application ID and service principal, so you can check it's the right app.

Which file to run​

FileWhen to run it
create.ps1, create.shYou have nothing yet. It creates the resource and gives the product's app its role in one run
grant.ps1, grant.shThe resource exists already, or you created it another way. It only gives the product's app its role
template.json (Deploy to Azure), with its source template.bicepYou prefer the Azure portal for a new resource. It creates the resource only, so run grant after it
manifest.jsonNot run. It lists the parameters, the role, the scope and what each file creates

Each use case below says exactly what each file creates, changes and never does.

Who may connect a resource​

The person who runs grant, or who finishes Connect and test in the Admin Portal, must be able to give access on the resource. That takes one of these Azure roles on the resource or above it:

  • Owner
  • User Access Administrator
  • Role Based Access Control Administrator

These roles hold Microsoft.Authorization/roleAssignments/write. Contributor, Reader and the data roles aren't enough. If your role is eligible in Privileged Identity Management (PIM), activate it first. To run create, you also need to create resources in the subscription, for example as Owner, or as Contributor together with User Access Administrator or Role Based Access Control Administrator. To deploy a template, Contributor on the resource group is enough.

Before the first test, the Admin Portal asks for one Azure permission on your behalf. See The Azure permission of Connect and test.

Parameters​

The commands in the Admin Portal fill these in. In Bash, the names are lowercase with hyphens: --account-name, --app-id and so on. Every name is checked against the Azure name rules before anything is sent to Azure.

ParameterUsed byMeaning
-AccountName, -ContainerNameguest documents storage, Safe sharing storageThe storage account and the container
-VaultName, -SecretNamecredential renewal: secretThe key vault and the secret
-VaultName, -CertificateNamecredential renewal: certificateThe key vault and the certificate
-WorkspaceNameaudit workspaceThe Log Analytics workspace
-RegioncreateThe Azure region of a new resource, for example westeurope
-AppIdall scriptsThe application (client) ID of the product's app in your tenant. The role goes to its service principal
-ResourceGroupNamecreate; the audit workspace grantOptional. The resource group of a new resource, default rg-easylife365. For the audit workspace, the resource group of the workspace you mean, needed when the name exists more than once
-Subscriptionall scriptsOptional. The subscription. Default: the current one. In Bash it also becomes your default subscription in the Azure CLI
-Yescreate; the audit workspace grantOptional. Uses the current subscription without asking. Without -Subscription or -Yes, these scripts show the current subscription and ask you to confirm it

Key vaults use Azure role-based access control​

EasyLife 365 works with key vaults that use Azure role-based access control. A vault that uses access policies isn't supported: the scripts stop on such a vault with a message and change nothing on it. You can switch the vault's permission model under Access configuration in the Azure portal, but check first who else uses the vault: after the switch, its access policies stop working for every other app and person, and they need roles instead. Often a separate vault for EasyLife 365 is simpler. The create scripts and the template create a vault with Azure role-based access control.

Guest documents storage​

EasyLife 365 Collaboration Insiders keeps the documents your guests sign in a container of your storage account. The EasyLife 365 Collaboration Insiders app gets Storage Blob Data Contributor on the container only.

FileCreates or changesNever does
createA resource group, when the account and the group don't exist yet. A storage account that accepts only Microsoft Entra ID sign-in (no account keys), only HTTPS with TLS 1.2 or higher, and no anonymous access, and that never copies data to another tenant. Its data is kept in one Azure region (locally redundant). The container, with no anonymous access. The role on the containerChange an existing account or container, delete anything
grantThe role on the container. It stops when the account or the container is missingCreate a resource, change a setting, delete anything
template.jsonThe storage account and the container, as create does. Deployed over an existing account, it sets that account's settings back to the ones above: it turns off account keys and anonymous access, which can cut off other apps that use the account, and makes the account locally redundant, which drops a copy in a second regionAssign a role

Files of version v1:

./create.ps1 -AccountName contosoguests -ContainerName guest-documents -Region westeurope -AppId <application-id>

Safe sharing storage​

EasyLife 365 Identity Insiders keeps the files of Safe sharing in a container of your storage account. The EasyLife 365 Identity Insiders app gets Storage Blob Data Contributor on the container only.

FileCreates or changesNever does
createA resource group, when the account and the group don't exist yet. A storage account with the same settings as for guest documents. The container, with no anonymous access. The role on the containerChange an existing account or container, delete anything
grantThe role on the container. It stops when the account or the container is missingCreate a resource, change a setting, delete anything
template.jsonThe storage account and the container, as create does. Deployed over an existing account, it sets that account's settings back, as for guest documents: it turns off account keys and anonymous access, which can cut off other apps, and makes the account locally redundantAssign a role

Files of version v1:

Credential renewal: secret​

EasyLife 365 Identity Insiders writes a renewed client secret into a secret of your key vault. The EasyLife 365 Identity Insiders app gets Key Vault Secrets Officer on that secret only.

FileCreates or changesNever does
createA resource group, when the vault and the group don't exist yet. A key vault: standard tier, Azure role-based access control, soft delete kept 90 days. The secret, with a random first value that goes straight into the vault and that nobody sees. The role on the secretChange an existing vault, overwrite an existing secret, read a secret's value, delete anything. It stops on a vault that uses access policies
grantThe role on the secret. It stops when the vault uses access policies, or when the vault or the secret is missingCreate a resource, read a secret's value, change a setting, delete anything
template.jsonThe key vault and the secret, with a random value. Deployed again or over an existing vault, it overwrites more: see the warning belowAssign a role

The scripts create the secret and check that it exists through Azure Resource Manager, and never read its value, so you don't need a Key Vault data role to run them.

A secret name may start with a hyphen, and the scripts read it as a name. In PowerShell, put such a name in quotes to be safe, for example -SecretName '-S': PowerShell itself reads an unquoted -S as a parameter.

warning

Deploy the template once, for a new vault. Deployed again, or over a vault that exists already, it writes a new random value into the secret, over the credential that EasyLife 365 Identity Insiders renewed. On a vault that uses access policies, it also switches the vault to Azure role-based access control and removes its access policies, which can cut off every other app and person that uses the vault, and it can set other vault settings back, such as its network rules. The scripts do none of this: they stop on a vault with access policies and keep an existing secret as it is. For an existing vault, use the scripts.

Files of version v1:

Credential renewal: certificate​

EasyLife 365 Identity Insiders renews a certificate of an app registration in your key vault. The EasyLife 365 Identity Insiders app gets Key Vault Certificates Officer on the key vault, so the role covers every certificate in it: the app can do anything with any of them, including deleting one for good, and can manage the vault's certificate issuers. Use a vault that holds only the certificates EasyLife 365 Identity Insiders renews. The certificate's own settings in Key Vault, such as its validity and key type, stay yours.

FileCreates or changesNever does
grantThe role on the vault. It stops when the vault uses access policies or is missing. It checks the format of the certificate name and shows it, but the role covers the whole vaultCreate a vault or a certificate, change a setting, delete anything

There is no create script and no template for this use case: create the vault, with Azure role-based access control, and the certificate yourself, then run grant.

Files of version v1:

Audit workspace​

EasyLife 365 Collaboration Insiders, EasyLife 365 Identity Insiders and EasyLife 365 Mail Insiders can keep the audit log in a Log Analytics workspace of yours, and they can share one. Each product has its own app, and each app gets Log Analytics Reader on the workspace only. create gives the role to the app whose application ID you pass. Run grant once with the application ID of each other product that reads the workspace.

The role lets the app read all data in the workspace, every table, not only the audit log. Use a workspace that holds only EasyLife 365 data, or one whose other data you're fine to share with it.

FileCreates or changesNever does
createA resource group, when the workspace and the group don't exist yet. A Log Analytics workspace: pay-as-you-go pricing, data kept 30 days. The role on the workspace. It asks for -ResourceGroupName when the name exists more than onceChange an existing workspace, delete anything
grantThe role on the workspace. It asks you to confirm the subscription, because workspace names are unique only within a resource group, and asks for -ResourceGroupName when the name exists more than onceCreate a resource, change a setting, delete anything
template.jsonThe workspace, as create does. Deployed over an existing workspace, it sets the pricing tier back and the workspace's default retention to 30 days, which deletes older data of every table that uses that defaultAssign a role

Files of version v1:

bash ./grant.sh --workspace-name contoso-audit --app-id <application-id>