Ejemplo n.º 1
0
    def __init__(self, name: str, resource_group_name: str, index_html: str = None, network_rules=None, tags: dict = None, opts: pulumi.ResourceOptions = None):
        """
        :param resource_name: The name of the resource.
        :param resource_group_name: The name of resource group 
        :param index_html: The name of the index.html upload to $web container.
        :param network_rules: A `network_rules` block as documented below.
        :param tags: A mapping of tags to assign to the resource.
        :param opts: Options for the resource.

        The **network_rules** object supports the following:

          * `bypasses` (`pulumi.Input[list]`) - Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Valid options are
            any combination of `Logging`, `Metrics`, `AzureServices`, or `None`.
          * `default_action` (`pulumi.Input[str]`) - Specifies the default action of allow or deny when no other rules match. Valid options are `Deny` or `Allow`.
          * `ip_rules` (`pulumi.Input[list]`) - List of public IP or IP ranges in CIDR Format. Only IPV4 addresses are allowed. Private IP address ranges (as defined in [RFC 1918](https://tools.ietf.org/html/rfc1918#section-3)) are not allowed.
          * `virtual_network_subnet_ids` (`pulumi.Input[list]`) - A list of resource ids for subnets.
        """

        self.__account = storage.Account(name,
                                  resource_group_name=resource_group_name,
                                  account_tier="Standard",
                                  account_kind="StorageV2",
                                  account_replication_type="LRS",
                                  static_website={
                                      "indexDocument": "index.html",
                                      "error404Document": "error.html"
                                  },
                                  network_rules=network_rules,
                                  enable_https_traffic_only=True,
                                  tags=self.__get_tags(tags),
                                  opts=opts)

        if index_html is not None:
            storage.Blob("index.html",
                         name="index.html",
                         content_type="text/html",
                         storage_account_name=self.__account.name,
                         storage_container_name="$web",
                         type="Block",
                         source=pulumi.FileAsset(index_html),
                         opts=opts)
Ejemplo n.º 2
0
app_service_plan = appservice.Plan("appservice-asp",
                                   resource_group_name=resource_group.name,
                                   kind="App",
                                   sku={
                                       "tier": "Basic",
                                       "size": "B1",
                                   })

storage_container = storage.Container(
    "appservice-c",
    storage_account_name=storage_account.name,
    container_access_type="private")

blob = storage.Blob("appservice-b",
                    storage_account_name=storage_account.name,
                    storage_container_name=storage_container.name,
                    type="Block",
                    source=asset.FileArchive("wwwroot"))


def get_sas(args):
    blob_sas = storage.get_account_blob_container_sas(
        connection_string=args[1],
        start="2020-01-01",
        expiry="2030-01-01",
        container_name=args[2],
        permissions={
            "read": "true",
            "write": "false",
            "delete": "false",
            "list": "false",
Ejemplo n.º 3
0
    resource_group_name=resource_group.name,
    administrator_login_password=administrator_login_password,
    administrator_login="******",
    version="12.0")

database = sql.Database("sqldb",
                        resource_group_name=resource_group.name,
                        server_name=sql_server.name,
                        requested_service_objective_name="S0")

connection_string = Output.all(sql_server.name, database.name) \
    .apply(lambda args: f"Server=tcp:{args[0]}.database.windows.net;Database={args[1]};") or "1111"

text_blob = storage.Blob("text",
                         storage_account_name=storage_account.name,
                         storage_container_name=container.name,
                         type="Block",
                         source=asset.FileAsset("./README.md"))

app_service_plan = appservice.Plan("asp",
                                   resource_group_name=resource_group.name,
                                   kind="App",
                                   sku=appservice.PlanSkuArgs(tier="Basic",
                                                              size="B1"))

blob = storage.Blob(
    "zip",
    storage_account_name=storage_account.name,
    storage_container_name=container.name,
    type="Block",
    source=asset.FileArchive("./webapp/bin/Debug/netcoreapp3.1/publish"))
Ejemplo n.º 4
0
# Create an Azure storage container

storagecontainer = storage.Container("vhd",
                                  name="vhd",
                                  storage_account_name=storageaccount.name
                                )

# Create an Azure group 
resource_group_images = core.ResourceGroup('rhcos_images', name='rhcos_images')
vhd_name_link = "https://rhcos.blob.core.windows.net/imagebucket/" + vhd_name

# Get Azure copy RHCOS image  
blob_copy = storage.Blob("copyblob", 
                          name=vhd_name,
                          type="Block",
                          source_uri=vhd_name_link,
                          storage_account_name=storageaccount.name,
                          storage_container_name=storagecontainer.name
                         )

server_public_ip = network.PublicIp(
    "server-ip",
    resource_group_name=resource_group.name,
    location=resource_group.location,
    allocation_method="Dynamic")

network_iface = network.NetworkInterface(
    "server-nic",
    resource_group_name=resource_group.name,
    ip_configurations=[{
        "name": "registryVNIC",
Ejemplo n.º 5
0
http_storage_account = storage.Account(
    "http",
    account_kind="StorageV2",
    account_tier="Standard",
    account_replication_type="LRS",
    resource_group_name=resource_group.name,
)

http_container = storage.Container(
    "http",
    storage_account_name=http_storage_account.name,
    container_access_type="private")

http_zib_blob = storage.Blob("http",
                             storage_account_name=http_storage_account.name,
                             storage_container_name=http_container.name,
                             type="Block",
                             source=asset.AssetArchive(
                                 {".": asset.FileArchive("./python")}))


def get_sas(args):
    blob_sas = storage.get_account_blob_container_sas(
        connection_string=args[1],
        start="2020-01-01",
        expiry="2030-01-01",
        container_name=args[2],
        permissions=storage.GetAccountBlobContainerSASPermissionsArgs(
            read=True,
            write=False,
            delete=False,
            list=False,
Ejemplo n.º 6
0
    "httpdotnet",
    account_kind="StorageV2",
    account_tier="Standard",
    account_replication_type="LRS",
    resource_group_name=resource_group.name,
)

httpdotnet_container = storage.Container(
    "http-dotnet",
    storage_account_name=httpdotnet_storage_account.name,
    container_access_type="private")

httpdotnet_zib_blob = storage.Blob(
    "http-dotnet",
    storage_account_name=httpdotnet_storage_account.name,
    storage_container_name=httpdotnet_container.name,
    type="Block",
    source=asset.AssetArchive(
        {".": asset.FileArchive("./dotnet/bin/Debug/netcoreapp3.1/publish")}))


def get_sas(args):
    blob_sas = storage.get_account_blob_container_sas(
        connection_string=args[1],
        start="2020-01-01",
        expiry="2030-01-01",
        container_name=args[2],
        permissions={
            "read": "true",
            "write": "false",
            "delete": "false",
Ejemplo n.º 7
0
    version="12.0")


database = sql.Database(
    "sqldb",
    resource_group_name=resource_group.name,
    server_name=sql_server.name,
    requested_service_objective_name="S0")

connection_string = Output.all(sql_server.name, database.name) \
    .apply(lambda args: f"Server=tcp:{args[0]}.database.windows.net;Database={args[1]};") or "1111"

text_blob = storage.Blob(
    "text",
    resource_group_name=resource_group.name,
    storage_account_name=storage_account.name,
    storage_container_name=container.name,
    type="block",
    source="./README.md"
)

app_service_plan = appservice.Plan(
    "asp",
    resource_group_name=resource_group.name,
    kind="App",
    sku={
        "tier": "Basic",
        "size": "B1"
    }
)

blob = storage.ZipBlob(